« || »

Launching maps and demos with a doubleclick

This is Linux only. I am using Debian and XFCE, you will need to adopt this to fit your setup (especially the paths). Just create a bash script in your path (I chose /usr/local/bin/ ). Currently I am using two scripts (one for maps, the other for demos). One could combine them into one but I am fine with how it works now. Also it might be terribly written and stupid, I am very open for feedback and fixes. So, here they are:

quakemap:

#!/bin/bash
GAME=$(echo $@ | sed ‘s/\/path\/to\/quake\///’ | sed ‘s/\/maps\/[a-zA-Z0-9_]*\.bsp//’)
MAP=$(echo $@ | sed ‘s/\/path\/to\/quake\///’ | sed ‘s/^[a-zA-Z0-9_]*\/maps\///’)
cd /path/to/quake/ && ./yourquakeengine +and commandline -game $GAME +map $MAP

quakedemo:

#!/bin/bash
GAME=$(echo $@ | sed ‘s/\/path\/to\/quake\///’ | sed ‘s/\/[a-zA-Z0-9_]*\.dem//’)
DEM=$(echo $@ | sed ‘s/\/path\/to\/quake\///’ | sed ‘s/^[a-zA-Z0-9_]*\///’)
cd /path/to/quake/ && ./yourquakeengine +and commandline -game $GAME +playdemo $DEM

Attention: The lines are wrapped here, look at the source of the webpage to see where a new line starts and where not. Make them executable (chmod +x) and tell your filebrowser to “open” .bsp files with “quakemap path&filename” and .dem files with “quakedemo path&filename”. For XFCE’s Thunar it’s “quakemap %f”.
Enjoy how great Linux is. :-)


13 Responses to “Launching maps and demos with a doubleclick”

  1. RickyT23 Says:
    04.02.2009 17:35

    Schbirid

    Fuck. I only just realised that was you :P

  2. Spirit Says:
    04.02.2009 18:45

    Heh, I don’t get why people have so much trouble getting that connection. Really. :D

  3. Bad Sector Says:
    05.02.2009 05:04

    You can do the same in Windows if you have bash available (like, for example, if you have MSYS installed) – there is nothing Linux-specific to it :-P.

  4. Spirit Says:
    05.02.2009 08:46

    Yeah, I thought about things like that (cygwin) too. But that’s cheating. ;)

  5. dooomer Says:
    15.02.2009 09:06

    I believe in Windows one can do the same with CMD batch files, even without bash or cygwin.

  6. Spirit Says:
    19.02.2009 16:25

    Added the following (originally pocketquake) map to filebase:
    kustok.zip

  7. Spirit Says:
    19.02.2009 16:43

    And some more (sda and hacking):
    e4m7u
    msacro
    ogitrev
    progref

  8. metlslime Says:
    08.03.2009 10:53

    actually you can do this in windows with a javascript or vbscript file using WScript.exe, i just wrote myself such a script a few days ago:

    var fs = new ActiveXObject(“Scripting.FileSystemObject”);
    var shell = new ActiveXObject(“WScript.Shell”);
    var arg = WScript.Arguments(0);
    var filename = fs.GetFileName(arg);

    if (filename.match(/^(.+)\.bsp$/i))
    {
    var mapname = RegExp.$1;

    if (shell.CurrentDirectory.match(/quake\\(.+)\\maps/i))
    {
    var modname = RegExp.$1;

    shell.CurrentDirectory = fs.GetParentFolderName(arg) + “\\..\\..”;
    shell.Run( “fitzquake -game ” + modname + ” -width 1680 -height 1050 -bpp 32 -heapsize 64000 +map ” + mapname );
    }
    }

  9. metlslime Says:
    08.03.2009 10:58

    part 2: to actually make this work:

    1. save the file to e.g. “D:\Scripts\quake_bsp_run.js”

    2. in windows explorer, choose Tools -> Folder Options -> File Types and find the entry for “BSP File” and click “Advanced”

    3. Click “New…” and in the first field type “Play” and for the second field type “WScript.exe D:\Scripts\quake_bsp_run.js %1″

    This works on XP, probably works on 2000 too, but i have no idea if it works in Vista or any of the 95/98/ME versions.

  10. metlslime Says:
    08.03.2009 11:02

    Final step:

    4. Make sure that “play” is the default action (click on “set default” after creating the action) for BSP files, otherwise you can use the context menu but double-click won’t work.

  11. Spirit Says:
    08.03.2009 12:31

    Nice! Thanks for sharing that.

  12. Stevenaaus Says:
    01.03.2010 05:24

    I linked this page in my how-to update (http://www.quaddicted.com/?p=374). It might be up… sometime in the next week ?

  13. k2 Says:
    04.07.2010 14:09

    Other launcher or starter:

    #!/bin/bash
    # path-to-quake-engine
    cd /usr/local/games/quake/
    mod=`zenity –list –height=300 –title=”Mod” –text=”Choose mod” –radiolist –column “Select” –column “Mod” TRUE id1 FALSE mod1 FALSE mod2 FALSE mod3 FALSE mod4 FALSE mod5 FALSE mod6 FALSE mod7 FALSE mod8 FALSE mod9 FALSE mod10`
    if [ "$?" -eq 1 ]; then
    exit
    fi
    skill=`zenity –list –height=290 –title=”Skill” –text=”Choose skill” –radiolist –column “Select” –column “Choose skill” FALSE 0 TRUE 1 FALSE 2 FALSE 3`
    if [ "$?" -eq 1 ]; then
    exit
    fi
    map=`(zenity –title=”Map” –text=”Write map or leave empty to main menu” –entry)`
    if [ "$?" -eq 1 ]; then
    exit
    fi
    ./quake -fullscreen -width 800 -height 600 -game “$mod” +skill “$skill” +map “$map”

    Here is my original and pictures http://kadve.blogspot.com/2010/06/blog-post.html . I am using Debian and Gnome.

Leave a Reply