Urban Terror Forums: Run Demo Script - Urban Terror Forums

Jump to content

 Login | Register 
Advertisement
Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Run Demo Script Rate Topic: -----

making a script that allows automatic demostarting

#1 User is offline   X-RaY Icon

  • Account: xray
  • Country:
  • Joined: 28-February 10
  • Posts: 130

Posted 02 July 2010 - 08:07 AM

Hey Guys,

Is it possible to make a script, that automatically opens demos, and starts converting them (to .avi)
and when that demo is done, automatically moves on to the next one.

It doesn't matter if i have to type in the names of the demos manually, but my imagination says it should be like this:

/demo demo1 // .dm_68 is automatically added
/wait 10 // Loading time (dunno if it's necessary and/or possible
/video

//when this demo has ended, the scripts knows it, and automatically moves on to the next one.


I've never heard anyone about it, so i think it's not possible...but maybe, very maybe... it is.

You guys have any idea?

Thanks in advance,
X-RaY
My Awesome Jumping Vids: @ My Youtube Channel!

#2 User is offline   n4n3rz Icon

  • Account: n4n3rz
  • Joined: 21-April 10
  • Posts: 45

Posted 02 July 2010 - 10:02 AM

never thought of using scripts for anything outside gameplay... hmm.

if urt cant do it autohotkey can.

#3 User is offline   Nexu Icon

  •   clan leader   
  • Account: nexu
  • Main tag: |it|
  • Country:
  • Joined: 26-June 07
  • Posts: 4,265

Posted 02 July 2010 - 12:29 PM

View PostX-RaY, on 02 July 2010 - 08:07 AM, said:

Is it possible to make a script, that automatically opens demos, and starts converting them (to .avi)
and when that demo is done, automatically moves on to the next one.

You can't do this with Q3 scripting since Q3 scripting lacks iteration statements.

But you can do this with cmd.exe (Windows) or sh (Linux/OSX).

Assume we're in the directory where UrbanTerror is installed (e.g.: C:\Program Files\UrbanTerror or /usr/share/games/urbanterror).
Now make a text file with each new line contain the filename of demo you wish recorded entirely. Something like this:

2010_6_28_21_43_44__8__7it_8__1nexu_ut4_tohunga_b8_CTF_Red_vs_B
2010_6_28_22_26_10__8__7it_8__1nexu_ut4_abbey_CTF_ChuCheuX_vs_P
2010_6_22_22_14_24__8__7it_8__1nexu_ut4_tohunga_b8_CTF_Red_vs_B
2010_6_22_22_30_48__8__7it_8__1nexu_ut4_tohunga_b8_CTF_Blue_vs_
2010_6_22_23_14_26__8__7it_8__1nexu_ut4_village_CTF_Red_vs_Blue


And let's name the text file demoplaylist.txt.

Windows: dm2avi.bat

@echo off
for /F "tokens=*" %%f in ('type demoplaylist.txt') do start /WAIT ioUrbanTerror.exe +exec somemoviecapture.cfg +demo %%f +video



C:\Program Files\UrbanTerror> dm2avi.bat



Linux/OSX: dm2avi.sh

#!/bin/sh
while read line
do
    ./ioUrbanTerror +exec somemoviecapture.cfg +demo $line +video
done < demoplaylist.txt


(change ioUrbanTerror to your UrbanTerror binary for your platform filename or wrapper start up script)

Make sure this script is executable:

chmod +x dm2avi.sh



./dm2avi.sh



So this solves the problem on iteration statement.

But now we run into the problem that UrbanTerror doesn't quit after the demo is done, neither does UrbanTerror has a command to quit when the demo playback is completed.
However, you could 'hack' around this problem by running a script in the background (one i can't be arsed to write now) that monitors qconsole.log (\logfile 2) and look for the string "frames to videos". Once you found this, you could issue a kill command.

Windows:

taskkill /FI "IMAGENAME eq ioUrbanTerror.exe"



Linux/OSX:

killall ioUrbanTerror


(change name to exact spelling)

Hope this gives you some idea.

#4 User is offline   Rylius Icon

  • Account: rylius
  • Main tag: CMM|
  • Country:
  • Joined: 28-February 10
  • Posts: 446

Posted 02 July 2010 - 12:51 PM

On Linux you could 'tail' the logfile.

#5 User is offline   X-RaY Icon

  • Account: xray
  • Country:
  • Joined: 28-February 10
  • Posts: 130

Posted 02 July 2010 - 03:48 PM

View PostNexu, on 02 July 2010 - 12:29 PM, said:

Linux/OSX: dm2avi.sh

#!/bin/sh
while read line
do
    ./ioUrbanTerror +exec somemoviecapture.cfg +demo $line +video
done < demoplaylist.txt


(change ioUrbanTerror to your UrbanTerror binary for your platform filename or wrapper start up script)


Ok, if i get it correct, it should be something like this:

#!/bin/sh
while read line
do
    cd ~/Games/Favorites/UrbanTerror
    ./ioUrbanTerror.app +exec somemoviecapture.cfg +demo $line +video
done < demoplaylist.txt


Don't get it entirely though.
the 'while read line'... does it automatically knows what 'read line' is?
if it does, how does he know here to get it from?
- since 'done < demoplaylist.txt' is at the end of the script.

then after the ./ioUrbanTerror.app,
well, that's basically something i don't understand at all.
but the 'somemoviecapture' should be like: q3config.cfg?

the killall ioUrbanTerror is something i'll have to worry about after this is done...
a killall ioUrbanTerror is atm no use, as long as this first script isn't working.

PS: platform is Mac OSX

This post has been edited by X-RaY: 02 July 2010 - 03:48 PM

My Awesome Jumping Vids: @ My Youtube Channel!

bullet_loaderAdvertisement

#6 User is offline   Nexu Icon

  •   clan leader   
  • Account: nexu
  • Main tag: |it|
  • Country:
  • Joined: 26-June 07
  • Posts: 4,265

Posted 02 July 2010 - 04:06 PM

View PostX-RaY, on 02 July 2010 - 03:48 PM, said:

Ok, if i get it correct, it should be something like this:


#!/bin/sh
cd ~/Games/Favorites/UrbanTerror
while read line
do
    ./ioUrbanTerror.app +exec somemoviecapture.cfg +demo $line +video
done < demoplaylist.txt

In this case, demoplaylist.txt should be in ~/Games/Favorites/UrbanTerror.

View PostX-RaY, on 02 July 2010 - 03:48 PM, said:

Don't get it entirely though.
the 'while read line'... does it automatically knows what 'read line' is?
if it does, how does he know here to get it from?
- since 'done < demoplaylist.txt' is at the end of the script.

"read line" is the command argument for the while loop command. It reads every line from input file and stores the line in a variable called $line.
"< demoplaylist.txt" act as input file. As "read line" command usually returns the command exit value 0 (equals true), it keeps running till the command "read line" exit value that is non 0 (like EOF).

View PostX-RaY, on 02 July 2010 - 03:48 PM, said:

then after the ./ioUrbanTerror.app,
well, that's basically something i don't understand at all.

You can 'debug' a shell script if you do

bash -x scriptname.sh



View PostX-RaY, on 02 July 2010 - 03:48 PM, said:

but the 'somemoviecapture' should be like: q3config.cfg?

q3config.cfg is what it will read anyway, but e.g.: http://forums.urbant...config-v2-beta/

or make your own.

#7 User is offline   X-RaY Icon

  • Account: xray
  • Country:
  • Joined: 28-February 10
  • Posts: 130

Posted 02 July 2010 - 06:03 PM

ok, Thanks for your help!
I'll have a look into it.
My Awesome Jumping Vids: @ My Youtube Channel!

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

Advertisement


Copyright © 1999-2024 Frozensand Games Limited  |  All rights reserved  |  Urban Terror™ and FrozenSand™ are trademarks of Frozensand Games Limited

Frozensand Games is a Limited company registered in England and Wales. Company Reg No: 10343942