Need a way to start rotation script when the new match begin
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
Excellent posts, both Jonathan and Phillipe. Regarding ed's interesting problem, very illuminating.
But what about mine?
As the thread topic reads, how can I reset the ROUND rotation (by returning to round1.cfg) when the new match begins? Is there a console command that can do that?
If there is, it would be relatively simple to script-output the command - but is there such a command at all?
But what about mine?
As the thread topic reads, how can I reset the ROUND rotation (by returning to round1.cfg) when the new match begins? Is there a console command that can do that?
If there is, it would be relatively simple to script-output the command - but is there such a command at all?
How about simply making 10 identical maps:Al's Used Cars wrote:how can I reset the ROUND rotation (by returning to round1.cfg) when the new match begins?
name-0.0.1.aamap.xml, name-0.0.2.aamap.xml, etc
And putting all the changing settings into each map?
From what I understand from your post, it's settings rotation that appears to be buggy, as the devs have confirmed.
As long as the in built map rotation works (I've not tried it), then this solution should fit the bill.
You should be aware that, let's say you had CYCLE_SPEED 5 setting in one map, it would stay at that setting until something else changed it. So, you could either put all variable settings into each map, or put them into everytime.cfg so they're reverted back to default for each round and only those settings specified in the map are altered.
If I'm not understanding the problem correctly, let me know.
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
yep, back at this again, presenting my obstinately ignorant questions in the hope of getting an answer I can understand.... I've been reading about bash and php scripting and have a little more understanding than i did before. (I've been busy with getting Riverworld up and running. See next post on that topic, please phillippe- it involves zonesV2.)
That said, my scenario has changed somewhat. Instead of trying to fix multiple issues with the 0.3.0 Shrinkin-Angels, I've reverted it to 2.8.2. So it will have the rudimentary ladder, but will need a script to handle round rotation.
I have attached my scripts for you all to review and correct. Keep in mind I'm a total amatuer as yet. I may have missed important things, or screwed up the syntax and puncuation.
1.-------------------------------------------------
#!/bin/sh
#gets ladder data from var, looks at last line and sends it to "rotation.sh" for processing
cat /home/admin/socc/var/ladderlog.txt | tail -n 1 | rotation.sh
2. --------------------------------------------------
#!/bin/sh
# create used variables
$ROUND=""
$MATCH=""
#begin loop
while read line;
test "$line" == "NEW_ROUND" || continue
$ROUND="expr $ROUND + 1";
#resets to arena 1 with new match
test "$line" == "NEW_MATCH" || continue
$ROUND="1";
#outputs rotation line into cfg
echo 'INCLUDE round$ROUND.cfg' > everytime.cfg;
#monitor, comment this cmd out when working ok
echo 'Round $ROUND now playing' > scriptlog.txt;
done;
--------------------------------
That said, my scenario has changed somewhat. Instead of trying to fix multiple issues with the 0.3.0 Shrinkin-Angels, I've reverted it to 2.8.2. So it will have the rudimentary ladder, but will need a script to handle round rotation.
I have attached my scripts for you all to review and correct. Keep in mind I'm a total amatuer as yet. I may have missed important things, or screwed up the syntax and puncuation.
1.-------------------------------------------------
#!/bin/sh
#gets ladder data from var, looks at last line and sends it to "rotation.sh" for processing
cat /home/admin/socc/var/ladderlog.txt | tail -n 1 | rotation.sh
2. --------------------------------------------------
#!/bin/sh
# create used variables
$ROUND=""
$MATCH=""
#begin loop
while read line;
test "$line" == "NEW_ROUND" || continue
$ROUND="expr $ROUND + 1";
#resets to arena 1 with new match
test "$line" == "NEW_MATCH" || continue
$ROUND="1";
#outputs rotation line into cfg
echo 'INCLUDE round$ROUND.cfg' > everytime.cfg;
#monitor, comment this cmd out when working ok
echo 'Round $ROUND now playing' > scriptlog.txt;
done;
--------------------------------
Start the map rotation script with something more like
The script should work if it looked more like this:
But would be far from perfect.
Study ladderlog.txt to get the order of things. The details of the script would depend on how you run certain round settings on the server.
Code: Select all
tail -f -n0 /path/to/ladderlog.txt | /path/to/rotation.sh
Code: Select all
#!/bin/sh
# create used variables
round=""
num_rounds=10 #the total number of rounds per match
#begin loop
while true;
do
read line
echo $line
if [ "$line" == "NEW_ROUND" ]
then
round=$(($round + 1))
if [ $round == $num_rounds ]
then
round=1;
fi
echo "INCLUDE round${round}.cfg"
#outputs rotation line into cfg
echo "INCLUDE round${round}.cfg" > /path/to/everytime.txt
fi
#resets to arena 1 with new match
if [ "$line" == "NEW_MATCH" ]
then
round="1"
fi
done
Study ladderlog.txt to get the order of things. The details of the script would depend on how you run certain round settings on the server.
Last edited by ed on Fri Aug 17, 2007 5:50 pm, edited 3 times in total.
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
nope.
changed everytime.txt to .cfg,
made rotation2.sh an exec with chmod,
inited the tail with (n0 not recognized in your cmd, changed it)
sudo tail /home/admin/soc/var/ladderlog.txt | /home/admin/soc/etc/games/armagetronad-dedicated/rotation2.sh
entered
> rotation2.sh
and booted up server. didnt work- no rotation. changed NEW_ROUND to ROUND_WINNER, ditto. tried booting first, then starting script... ditto
anyone know bash scripting cmds? i have a feeling its my syntax
changed everytime.txt to .cfg,
made rotation2.sh an exec with chmod,
inited the tail with (n0 not recognized in your cmd, changed it)
sudo tail /home/admin/soc/var/ladderlog.txt | /home/admin/soc/etc/games/armagetronad-dedicated/rotation2.sh
entered
> rotation2.sh
and booted up server. didnt work- no rotation. changed NEW_ROUND to ROUND_WINNER, ditto. tried booting first, then starting script... ditto
anyone know bash scripting cmds? i have a feeling its my syntax
Sorry, typo.
I've edited my above post.
You need the -f otherwise it will stop parsing the file when it reaches the end of the file.
The -n0 tells it not to pass any lines of ladderlog.txt to the script until new ones are added (to stop the script from processing old data).
I've edited my above post.
You need the -f otherwise it will stop parsing the file when it reaches the end of the file.
The -n0 tells it not to pass any lines of ladderlog.txt to the script until new ones are added (to stop the script from processing old data).
Last edited by ed on Fri Aug 17, 2007 3:37 pm, edited 1 time in total.
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
heres the result
admin@ubuntu:~/soc/etc/games/armagetronad-dedicated$ tail -f -n0 ladderlog.txt | ./rotation2.sh
-bash: ./rotation2.sh: Permission denied
tail: cannot open `ladderlog.txt' for reading: No such file or directory
tail: no files remaining
admin@ubuntu:~/soc/etc/games/armagetronad-dedicated$
should i sudo and use the absolute path?
admin@ubuntu:~/soc/etc/games/armagetronad-dedicated$ tail -f -n0 ladderlog.txt | ./rotation2.sh
-bash: ./rotation2.sh: Permission denied
tail: cannot open `ladderlog.txt' for reading: No such file or directory
tail: no files remaining
admin@ubuntu:~/soc/etc/games/armagetronad-dedicated$
should i sudo and use the absolute path?
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
Now you're really confusing me
You run your armagetronad-dedicated, in a screen session is a popular way to do it.
You then run the command:
tail -f -n0 /path/to/ladderlog.txt | /path/to/rotation.sh
in another screen session.
which should take care of your settings rotation reading ladderlog.txt and populating everytime.cfg. Which is read by the armaserver at the end of each round. So the new settings will take effect at the start of the following round.
The rotation.sh script is useless on it's own and will do nothing.
You run your armagetronad-dedicated, in a screen session is a popular way to do it.
You then run the command:
tail -f -n0 /path/to/ladderlog.txt | /path/to/rotation.sh
in another screen session.
which should take care of your settings rotation reading ladderlog.txt and populating everytime.cfg. Which is read by the armaserver at the end of each round. So the new settings will take effect at the start of the following round.
The rotation.sh script is useless on it's own and will do nothing.
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
sorry for the confusion. Its a remotely hosted server on a commercial machine several hundred miles from me. I use terminal to enter stop/start cmds but thats about it- i dont have screen sessions as such.
I guess this limits what i can do. I may need to make the command
tail -f -n0 /path/to/ladderlog.txt | /path/to/rotation.sh
a little standalone script to keep it running when i log out?
I guess this limits what i can do. I may need to make the command
tail -f -n0 /path/to/ladderlog.txt | /path/to/rotation.sh
a little standalone script to keep it running when i log out?
- Lucifer
- Project Developer
- Posts: 8640
- Joined: Sun Aug 15, 2004 3:32 pm
- Location: Republic of Texas
- Contact:
That's exactly what screen is for. Try "man screen" to get an idea what it's all about.Al's Used Cars wrote:sorry for the confusion. Its a remotely hosted server on a commercial machine several hundred miles from me. I use terminal to enter stop/start cmds but thats about it- i dont have screen sessions as such.
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
- Al's Used Cars
- On Lightcycle Grid
- Posts: 45
- Joined: Sun Dec 03, 2006 3:22 pm
- Location: Baltimore, MD
ed, i've changed a few things, added quotes to variables where it seemed needed, added semicolons that seemed missing, etc. And rotation.sh is in the same dir with everytime.cfg, so /pathto is now ./
does it look better or worse?
#!/bin/sh
# create used variables
round=""
num_rounds="10" #the total number of rounds per match
#begin loop
while true;
do
read line
echo $line
if [ "$line" == "NEW_ROUND" ]
then
round=$(($round + 1))
if [ $round == $num_rounds ]
then
round="1";
fi
#outputs rotation line into cfg
echo "INCLUDE round${round}.cfg" > ./everytime.cfg;
fi
#resets to arena 1 with new match
if [ "$line" == "NEW_MATCH" ]
then
round="1";
fi
done
does it look better or worse?
#!/bin/sh
# create used variables
round=""
num_rounds="10" #the total number of rounds per match
#begin loop
while true;
do
read line
echo $line
if [ "$line" == "NEW_ROUND" ]
then
round=$(($round + 1))
if [ $round == $num_rounds ]
then
round="1";
fi
#outputs rotation line into cfg
echo "INCLUDE round${round}.cfg" > ./everytime.cfg;
fi
#resets to arena 1 with new match
if [ "$line" == "NEW_MATCH" ]
then
round="1";
fi
done
bash doesn't really need semi colons, they are optional.
Can't see what else you changed. Looks like it should still work.
I tested mine on the ladderlog.txt running on the live ctwf and it had the desired effect of filling my specified file with the include round number.
Like I said, this is not a totally accurate method of doing this. Other factors, like total number of rounds, if you have a win match score set. These other factors would also have to be taken into account to make it work perfectly.
But this should give you a base to work from.
You might want to look at this post and maybe this one too.
Neither do exactly what you're after, but they both parse arma log files and write to everytime.cfg.
Can't see what else you changed. Looks like it should still work.
I tested mine on the ladderlog.txt running on the live ctwf and it had the desired effect of filling my specified file with the include round number.
Like I said, this is not a totally accurate method of doing this. Other factors, like total number of rounds, if you have a win match score set. These other factors would also have to be taken into account to make it work perfectly.
But this should give you a base to work from.
You might want to look at this post and maybe this one too.
Neither do exactly what you're after, but they both parse arma log files and write to everytime.cfg.