Xonotic Forums
[SOLVED] Load map immediately after game starts - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3)
+--- Forum: Xonotic - Help & Troubleshooting (https://forums.xonotic.org/forumdisplay.php?fid=4)
+--- Thread: [SOLVED] Load map immediately after game starts (/showthread.php?tid=3467)



Load map immediately after game starts - Maddin - 09-05-2012

There is a way to start Xonotic via a command in your shell/terminal:
Code:
/absolute/file/path/to/game/executable -basedir /absolute/file/path/to/game/

Now how is it possible to add a command which immediately loads a specific map after the game has started? I tried several things like adding "map mapname" or -map mapname after the command mentioned above but nothing worked so far.

Has anybody an idea how to achieve this?


RE: Load map immediately after game starts - Mr. Bougo - 09-05-2012

/path/to/xonotic +chmap mapname

EDIT: you can pass any command or cvar that way. xonotic +bot_number 1 +chmap mapname


RE: Load map immediately after game starts - Maddin - 09-05-2012

Ah, so it was the plus as a prefix. Very nice! Thanks! Smile


RE: Load map immediately after game starts - edh - 09-05-2012

Plus is for cvars, minus is for commandline options. You can use this things like -window, -width, -height, -bpp they're mostly the same as for GLQuake/WinQuake. Do you need basedir in this example?


RE: Load map immediately after game starts - Mr. Bougo - 09-05-2012

It depends on the way the binary itself is launched. The default basedir is $PWD, and the shell script wrapper takes care of fixing that.


RE: Load map immediately after game starts - edh - 09-05-2012

(09-05-2012, 11:58 AM)Mr. Bougo Wrote: It depends on the way the binary itself is launched. The default basedir is $PWD, and the shell script wrapper takes care of fixing that.

What I was thinking, in which case running the shell script would be better except in a few odd circumstances where parameters don't get passed properly.


RE: Load map immediately after game starts - Mr. Bougo - 09-05-2012

Indeed. The shell script accepts the same parameters anyway.


RE: Load map immediately after game starts - Maddin - 09-05-2012

It is need when you want to launch the game from a dock app or (which actually is the subject of interest) my upcoming GUI for q3map2 which also allows the user to directly start up the game and play the map without even typing commands or clicking things before being able to play the map.


RE: Load map immediately after game starts - Mr. Bougo - 09-05-2012

Maddin, how did you install Xonotic? Unless you're using a non-default basedir you shouldn't need to specify it.


RE: Load map immediately after game starts - rocknroll237 - 09-05-2012

How do I access this terminal thingy for Xonotic? I needed it so I could input a command that effects texture compression...


RE: Load map immediately after game starts - Mr. Bougo - 09-05-2012

There's the shell (that's typically used in Linux or Mac OS -- the windows command line is a shell too but it sucks). If you want to access the Xonotic terminal, that's shift escape, or the key above tab on the left.

What Maddin is referring to is the shell (you can usually access it with a terminal emulator, more commonly just called "terminal"). But the command he wants to feed to Xonotic is a Xonotic terminal command, which you can just type the usual way after shift escape.


RE: Load map immediately after game starts - Maddin - 09-05-2012

I am using autobuild for this purpose. The parent directory location is '/home/user/Games/Xonotic/Xonotic'. If you are wondering why I have it in a sub folder: The autobuild scripts are in '/home/user/Games/Xonotic' therefore the game is created in a sub folder. Tongue


RE: Load map immediately after game starts - Mr. Bougo - 09-05-2012

Why don't you use xonotic-linux-glx.sh or xonotic-linux-sdl.sh? These are meant to select the right build and basedir for you!


RE: Load map immediately after game starts - Maddin - 09-05-2012

Hmm right, why didn´t I do that? Undecided Big Grin

+1 for you again Mr.Bougo, you´re just the best!

Edit:

Ah, now I know why I didn´t. For some reason the sdl script won´t be executed (it´s a link maybe that´s why?) from my dock and using glx I haven´t got sound.


RE: Load map immediately after game starts - Cyber Killer - 09-06-2012

The sdl script is a symlink to the glx one (the script selects the exec version based on it's own filename), so if you'd copy the glx script and change it's name then you should get the same effect.

BTW: that's a mighty strange dock you got there, that can't use a symlink


RE: Load map immediately after game starts - Maddin - 09-06-2012

It´s Avant Window Navigator (AWN)... I like it. Big Grin Thanks for the tip, the con of this method is that I have to do that each time I upgrade Xonotic as such files are deleted during updating.


RE: Load map immediately after game starts - It'sMe - 09-11-2012

To prevent the rsync updater deleting your files, you can modify the rsync script and add a line like
Code:
excludes="$excludes --exclude=/your_file"
to your architecture section.


RE: Load map immediately after game starts - Maddin - 11-05-2012

Again, I´m bumping into this problem but now while using Windows. What I want to do is launching the game via a batch file and immediately load some map. I tried this...
Code:
C:/path/to/xonotic/executable -basedir C:/path/to/xonotic/ +chmap stormkeep
.. but the Xonotic console tells me that it can´t load some compressed files and that it needs zlib.dll (or something like that) to work properly. I guess that it has some dependancy struggle, but how can I fix that?


RE: Load map immediately after game starts - Mr. Bougo - 11-05-2012

Launch the executable from the game directory and omit basedir:
Code:
cd C:/path/to/xonotic/
executable +chmap stormkeep
The reason for this is that dll files are included in the basedir, but these are loaded from the current directory, which is why you first have to set the current directory.


RE: Load map immediately after game starts - Maddin - 11-05-2012

Thank you, it works!

Though I should mention that you have to use backslashes, otherwise the commandline fails to read the path (because it´s not UNIX).

Still, Mr. Bougo rocks!