(http://1upclan.info/public/upload/projects/1up_demo_loader/1up_demo_loader_ss.png)
If you review alot of demos then you know how much of a pain it can be to use the standard Urban Terror client by itself which is why the demo loader application was created to help make this task as simple as possible. For more details and a download link, just visit our projects page located here (http://www.1upclan.info/projects.php). (demo loader is located at the bottom of the page) We hope you will find it useful and as always feedback is welcome.
Thanks,
Tesla[1up]
HOKAY! HACKY BASH SCRIPT TIEM! 8)
I've slapped together a bash script for this, but for some reason I can't attach it to this post, so I'll dump it here.
#!/bin/bash
### KD197's Quick UrT Demo Loader ###
### Yeah I know it sucks! But it ###
### works doesn't it?! ###
### Requires sed and tr ###
OS=$(uname -s)
URT() {
if [[ $OS == "Linux" ]]; then
### Uncomment out the following line if you use cpufrequtils ###
### and wish to set your cpu mode to "performance". ###
#sudo cpufreq-set -r -g performance
### Start UrT in a second X session ###
DISPLAY=:1.0
xinit /usr/bin/urbanterror $* -- :1
else
### Run Urban Terror on a Mac ###
/Applications/UrbanTerror/ioUrbanTerror.app/Contents/MacOS/ioUrbanTerror.ub $*
fi
}
### GETOPTS ###
while getopts ":w:h" OPTION
do
case $OPTION in
w) FLAG="w" INFILE=$OPTARG;;
h) FLAG="h";;
esac
done
### Set paths ###
### Change the ".urbanterror/q3ut4/demos/" part to whatever your path is ###
DIR="$HOME/.urbanterror/q3ut4/demos/"
COM='+set com_cameramode 1 +demo'
WCOM='+set com_cameramode 1 +set r_shownormals 1 +demo'
### Move demos to the demos folder and play with selected options ###
if [[ $FLAG == "h" ]]; then
echo "Options: -h to show this help"
echo " -w /path/to/demo.dm_68 to start with r_shownormals 1"
echo ""
echo "By default, demos are run with com_cameramode 1 so that the"
echo "keyboard may be used, for timescale binds etc; files are moved"
echo "to the demos folder, and the filename is converted to UPPERCASE"
echo "because the Linux version doesn't like the demos otherwise :P"
elif [[ $FLAG == "w" ]]; then
FILE="$(echo $INFILE | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $INFILE ${DIR}${FILE}
URT $WCOM $FILE
else
FILE="$(echo $1 | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $1 ${DIR}${FILE}
URT $COM $FILE
fi
Copy and paste that into a file (lets call it "urtdml" for sake of example) somewhere convenient and chmod +x it. Then pop open a terminal, and run it like "urtdml /path/to/demo.dm_68" and Bob's your uncle. I guess you could probably do some jazz to make dm_68's point at this scriptlet but that's up to you, I have no graphical filemanager to test it on. Besides, running it through a terminal is better because then you can add the "-w" switch to turn shownormals on 8)
Default behaviour (as seen in "help" the -h option) is that it will move the file to your demos folder if it's not already there, and convert the file name to uppercase (for the Linux users out there) then start the demo rolling with com_cameramode 1, which means you can use any keybinds you might have for increasing/decreasing timescale.
It's not a patch on Tesla's fancy app but maybe this'll fill a hole for Linux and Mac users until someone writes an equivalent of Tesla's launcher. :-[
I dunno if it's worthy of being on the projects page as it's just a terminal script, but let me fiddle with it some more and see if I can make something a bit nicer :)
EDIT:
Now in GUI flavour! 8) Requires Zenity, but can still be run without. (It will tell you if it can't find Zenity and exit.)
#!/bin/bash
### KD197's Quick UrT Demo Loader ###
### Requires sed, tr and Zenity ###
### Now in GUI flavour! ###
OS=$(uname -s)
URT() {
if [[ $OS == "Linux" ]]; then
### Uncomment out the following line if you use cpufrequtils ###
### and wish to set your cpu mode to "performance". ###
#sudo cpufreq-set -r -g performance
### Start UrT in a second X session ###
DISPLAY=:1.0
xinit /usr/bin/urbanterror $* -- :1
else
### Run Urban Terror on a Mac ###
/Applications/UrbanTerror/ioUrbanTerror.app/Contents/MacOS/ioUrbanTerror.ub $*
fi
}
### Define Colours ###
NC="\x1b[0;32m"
DC="\x1b[0m"
WC="\x1b[0;31m"
### GETOPTS ###
while getopts ":w:n:h" OPTION
do
case $OPTION in
w) FLAG="w" INFILE=$OPTARG;;
n) FLAG="n" INFILE=$OPTARG;;
h) FLAG="h";;
esac
done
### Set paths ###
### Change the ".urbanterror/q3ut4/demos/" part to whatever your path is ###
DIR="$HOME/.urbanterror/q3ut4/demos/"
COM='+set com_cameramode 1 +demo'
WCOM='+set com_cameramode 1 +set r_shownormals 1 +demo'
### Main ###
### Display help ###
if [[ $FLAG == "h" ]]; then
echo -e "${NC}Options: -h${DC} to show this help"
echo -e " ${NC}-u${DC} /path/to/demo.dm_68 to start normally"
echo -e " ${NC}-w${DC} /path/to/demo.dm_68 to start with r_shownormals 1"
echo ""
echo "If no option is passed, graphical mode will be used."
echo "By default, demos are run with com_cameramode 1 so that the"
echo "keyboard may be used, for timescale binds etc; files are moved"
echo "to the demos folder, and the filename is converted to UPPERCASE"
echo "because the Linux version doesn't like the demos otherwise :P"
### Run with r_shownormals ###
elif [[ $FLAG == "w" ]]; then
FILE="$(echo $INFILE | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $INFILE ${DIR}${FILE}
URT $WCOM $FILE
### Run normally ###
elif [[ $FLAG == "n" ]]; then
FILE="$(echo $INFILE | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $INFILE ${DIR}${FILE}
URT $COM $FILE
### Run with Zenity GUI ##
else
ZFILE=$(zenity --title="Select a demo" --file-selection 2>/dev/null) \
|| { echo -e "${WC}*** Zenity was not found or the operation was cancelled! ***${DC}"; \
echo "If opening a file failed, either install Zenity or run with";
echo "the -h switch to see available options for CLI usage."; exit 1; }
FILE="$(echo $ZFILE | sed 's/.*\/\(.*\.dm_68\)/\1/' | tr [:lower:] [:upper:] | sed 's/DM_68$/dm_68/')"
mv $ZFILE ${DIR}${FILE}
zenity --title="Use r_shownormals?" --question --text "Use r_shownormals?"
if [[ $? == "0" ]]; then
URT $WCOM $FILE
else
URT $COM $FILE
fi
fi