Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[script] Right click open map in Nexuiz with Gnome (Ubuntu)
04-14-2009, 01:28 PM (This post was last modified: 04-14-2009 05:43 PM by -z-.)
Post: #1
[script] Right click open map in Nexuiz with Gnome (Ubuntu)
Last night fabzor had asked me a question about opening maps with Nexuiz via a script... eventually it got out that he wanted to be able to right click a pk3 or bsp and load it with Nexuiz.

I whipped up the following and thought I'd share it with you all:

Open up the terminal and type the following to create the script that's going to run off the right click, and give it executable permissions.

cd "$HOME/.gnome2/nautilus-scripts" && touch "Open Nexuiz Map" && chmod +x "Open Nexuiz Map" && gedit "Open Nexuiz Map" &

Your text editor will pop up. Paste the following code and set the variables to match your settings.

# Set variables

if [[ "$(echo $1|awk -F . '{print $NF}')" == "pk3" ]]; then
    # Find the name of the bsp
    mapname=$(unzip -l $1 | grep .bsp | awk '{ print $4 }' | sed 's/maps\/\([A-Za-z_0-9.-]*\)\.bsp/\1/' | grep -vi .bsp)

if [[ "$(echo $1|awk -F . '{print $NF}')" == "bsp" ]]; then
    mapname=$(basename $1 .bsp)

# Run it
$nexuizdir/$nexuizbin -basedir $nexuizdir +map $mapname

In your terminal again, open your Nexuiz data directory:
nautilus ~/.nexuiz/data

Now right click a map >> scripts >> Open Nexuiz Map

You can also right click open bsp's in your ~/.nexuiz/data/maps folder :)

For your commandline junkies, you can add a little alias as a convenience:
gedit $HOME/.bashrc

Add the following (with your path) to the bottom your your bashrc):
alias nexmap='"/home/tyler/.gnome2/nautilus-scripts/Open Nexuiz Map"'

Save and close, type:
to enter a new bash session.

cd ~/.nexuiz/data
nexmap <mapname.pk3>
to open it from the command line
Inspire your neighbor, they'll inspire you back.

[url=]maps.nn[/url] | [url=]pics.nn[/url] | [url=]chat.nn[/url] | [url=]2.5 cvar browser[/url]
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump:

Contact Us | Nexuiz Ninjaz Home | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication