Page 1 of 2
Klicking an a Purebasic Program in KDE
Posted: Fri Aug 12, 2005 12:08 am
by Brujah
Hy Purebasic Fans,
I want to achieve that when you Klick on my Program File in KDE my game is executed.
Posted: Fri Aug 12, 2005 12:18 am
by Brujah
The game runs, but it can't find the other resource files (like my graphics).
Can I read out the path that I got called from?
I have to set this path I think.
And right now I have no idea how to do that.
Posted: Fri Aug 12, 2005 2:20 am
by Beach
I'm not sure if this would work for you but I use it when I need something out of the environment. Reading 'PWD' gives you the current directory...
BTW: I did not write this code, it is a little to dark for me just yet...
Code: Select all
Procedure.s GetEnv(Variable$)
Protected *Environ.LONG
!extrn _environ
!mov eax, [_environ]
!mov [esp+4], eax
Variable$ + "="
While *Environ\l <> 0
If CompareMemoryString(@Variable$, *Environ\l, 0, Len(Variable$)) = 0
ProcedureReturn PeekS(*Environ\l + Len(Variable$))
EndIf
*Environ + 4
Wend
ProcedureReturn ""
EndProcedure
MessageRequester("test",GetEnv("PWD"))
Posted: Fri Aug 12, 2005 2:44 am
by freak
You can also use getenv() from the libc, which is probably a bit cleaner:
Code: Select all
Procedure.s GetEnv(Variable$)
*result = getenv_(Variable$)
If *result
ProcedureReturn PeekS(*result)
Else
ProcedureReturn ""
EndIf
EndProcedure
Posted: Fri Aug 12, 2005 3:58 am
by Beach
Yes, much cleaner!

Posted: Fri Aug 12, 2005 7:30 am
by Brujah
Thanx a lot.
I integerated this routine and when I call my program from
the Commandline its working fine.
But when I click on the File in KDE it seems that thiy Environment Variable "PWD" is not set.
Is there another way to get a KDE Environment Variable?
Posted: Tue Aug 16, 2005 5:34 am
by Brujah
I solved the problem in a different way.
I succeeded in creating a rpm for my game.
Now its working fine. Even with a Icon on the Desktop after installation!
Posted: Fri Aug 19, 2005 8:34 pm
by Num3
Brujah wrote:I solved the problem in a different way.
I succeeded in creating a rpm for my game.
Now its working fine. Even with a Icon on the Desktop after installation!
Uh!
Please share on all topics

My Lost Labyrinth Spec
Posted: Sat Aug 20, 2005 1:58 am
by Brujah
Maybe its useful to anyone.
Here comes the spec that I created for my game.
You create the rpm with it using the command "rpmbuild -ba laby2.spec"
I translated it to 3 languages.
Code: Select all
%define name laby
%define version 0.9.9
%define release 0
Name: %{name}
Summary: Lost Labyrinth is a so-called "roguelike" roleplaying computer game
Summary(de): Lost Labyrinth ist ein sogenanntes "roguelike"-Computerspiel
Summary(es): Lost Labyrinth es un Juego para computadoras parecido como el viejo "Roque"
Copyright: GPL
Group: Amusements/Games/Other
URL: http://laby.toybox.de/
Version: %{version}
Release: %{release}
Source0: %{name}_%{version}.tar.gz
Packager: Markus <mar_doe@gmx.de>
BuildRoot: /var/tmp/%{name}-%{version}-%{release}
Autoreqprov: On
%description
Lost Labyrinth is a so-called "roguelike" roleplaying computer game. Lost
Labyrinth has the following features:
* relatively short gameplay (about 10-20 minutes)
* very high replayability; nearly everything in the game is randomly generated
* Sketelon; a lot of options during the character generation; each character
type requires another strategy to survive
* Multiplayer games on the same machine (up to 4 players)
* "Zelda"-like graphics, sound and animation; smooth scrolling of game screen
* Open Source (GPL)
%description -l de
Lost Labyrinth ist ein sogenanntes "roguelike"-Computerspiel. Lost Labyrinth
bietet (im Vergleich zu ähnlichen Spielen) folgende Features:
* sehr kurze Spieldauer (ca. 10-20 Minuten)
* sehr hoher "Replayability"-Faktor; das Labyrinth wird komplett
zufallsgeneriert
* enorm große Anzahl an Charakteroptionen bei der Erschaffung; jeder Charakter
benötigt eine andere Spieltaktik
* Spiele mit mehreren Spielern an derselben Maschine (bis zu vier Spieler)
* "Zelda"-ähnliche Grafik, Sound & Animationen; weiches Scrolling
* Open Source (GPL)
%description -l es
Lost Labyrinth es un Juego para computadoras parecido como el viejo "Roque". Lost Labyrinth
in cambia tiene esos nuevos funciones:
* dura muy poco tiempo (normalmente 10-20 Minutos)
* el Labirinto es creado totalmente de casualidad
* muchas opciones para crear su personaje; cada personaje necesita una propia estrategia
* juegos con maximo 4 jugadores en la misma maquina
* Graficas como "zelda", Sonido & Animaciones; suave Scrolling
* Open Source (GPL)
%prep
rm -rf $RPM_BUILD_ROOT
%setup -n %{name}_%{version}
%build
%install
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
mkdir -p "$RPM_BUILD_ROOT"/usr/games/%{name}
cp -r ./* "$RPM_BUILD_ROOT"/usr/games/%{name}
chmod 755 "$RPM_BUILD_ROOT"/usr/games/%{name}/laby
chmod 777 "$RPM_BUILD_ROOT"/usr/games/%{name}/highscores.dat
cat << EOF > "$RPM_BUILD_ROOT"/usr/games/%{name}/laby
#!/bin/sh
cd %{_libdir}/laby
killall artsd
./purebasic.exe
EOF
cat << EOF > "$RPM_BUILD_ROOT"%/usr/share/applications/laby.desktop
[Desktop Entry]
Encoding=UTF-8
Name=LostLabyrinth
GenericName=LostLabyrinth
GenericName[de]=LostLabyrinth
Comment=Laby Rulez!
Exec=/usr/games/%{name}/laby
Icon=/usr/games/%{name}/laby.xpm
Type=Application
Categories=Application;Game;RolePlaying;
EOF
%post
cat << EOF > ~/Desktop
[Desktop Entry]
Encoding=UTF-8
Name=LostLabyrinth
GenericName=LostLabyrinth
GenericName[de]=LostLabyrinth
Comment=Laby Rulez!
Exec=/usr/games/%{name}/laby
Icon=/usr/games/%{name}/laby.xpm
Type=Application
Categories=Application;Game;RolePlaying;
EOF
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
%files
%defattr(-, root, root)
/usr/games/%{name}/*
%changelog
* Mon Aug 15 2005 drcux <drcux@freenet.de>
First Build
Posted: Sat Aug 20, 2005 9:44 pm
by Num3
Cool!
But how did you solve the current working directory thing?
The "GetEnv("PWD")" code only works when the app is launched from a shell (has it should, because PWD *is* a shell command)...
Posted: Sun Aug 21, 2005 12:23 am
by Brujah
There is a Script "laby" created in /usr/games which changes into the right directory and executes the game.
So you can call the game by typing laby.
And you get a Link in your Start Menu. Should be enough to call the game easily now.
Posted: Sun Aug 21, 2005 12:33 am
by freak
Num3: PWD is not a command, it is a environment variable, that is set by the shell.
Thats the reason why it only works there

Posted: Sun Aug 21, 2005 9:36 pm
by Num3
Anyway i really like lost labirint, i play it all the time :roll:
But there seems to be a problem with loading saved games, it always gives me "tempered error" even if i don't touch it!
Posted: Mon Aug 22, 2005 12:59 am
by Brujah
So you use the windows version!
I have no idea about this.
Right now my version exists only for linux and I got multiplayer mode too!

Posted: Thu Aug 25, 2005 9:18 am
by Num3
Can you fix the loading routines for windows?
I got to level 19, died, and when i tried to reload the previous level i always get the error...