Autorserver macros & tracks

Discussion related to Turbo Sliders and beta version feedback.

Moderator: Forum Moderators

Post Reply
User avatar
S_Racer
Posts: 23
Joined: Mon Sep 15, 2008 11:19 am
Location: Québec, Canada
Contact:

Autorserver macros & tracks

Post by S_Racer » Tue May 31, 2011 3:35 pm

Hi, i want to make an autoserver that will pick tracks automatically in a very precise sequence.

To give you a global overview, i got 5 sub-folders in my /tracks folder : Racing, Fun, Punaball, Battle and X-Bumpz.

I would like to make a macro that will do the following :

- Select randomly 1 track in the Racing folder
- Select randomly 1 track in the Fun folder
- Select randomly 1 track in the Racing folder
- Select randomly 1 track in the Punaball folder
- Select randomly 1 track in the Racing folder
- Select randomly 1 track in the Battle folder
- Select randomly 1 track in the Racing folder
- Select randomly 1 track in the Fun folder
- Select randomly 1 track in the Racing folder
- Select randomly 1 track in the X-Bumpz folder
etc....

Until now i only found the "/tracks addrnd #" command but it takes tracks from the main /tracks folder and i cannot find how to instruct it to look into the sub-folders. And i cannot simply drop every track in the main folder because i need to balance the cup like stated above (1 racing and 1 other type alternately).

Any idea ?

Thx !
Silver Arrows Racing | Tracks, cars and events

User avatar
dede
Community User Level: 5
Community User Level: 5
Posts: 3314
Joined: Mon Apr 10, 2006 10:29 am
Location: Milan (Italy)
Contact:

Post by dede » Tue May 31, 2011 5:27 pm

There is no simple way of doing that, since the /tracks /addrnd command works only on main folder. The simplest way to do it, in my opinion, is to make a server-side script, but of course you need programming skills to achieve that.

User avatar
S_Racer
Posts: 23
Joined: Mon Sep 15, 2008 11:19 am
Location: Québec, Canada
Contact:

Post by S_Racer » Tue May 31, 2011 6:40 pm

thx for quick reply dede !

Actually i am a programmer :D . How do the server scripts work ? where can i find a place to start looking into this ?

Thx !
Silver Arrows Racing | Tracks, cars and events

Tijny
Community User Level: 5
Community User Level: 5
Posts: 1514
Joined: Sat Nov 06, 2004 7:59 pm
Location: Netherlands

Post by Tijny » Tue May 31, 2011 7:49 pm

S_Racer wrote:thx for quick reply dede !

Actually i am a programmer :D . How do the server scripts work ? where can i find a place to start looking into this ?

Thx !
It's briefly documented in doc/README-autoserver.txt. I actually made something just like it for the LVP servers, here's a quick example for you (I used PHP, but it can be any language that can be run from the command line):

sliders.ini:

Code: Select all

ScriptsOn 1
CustomCmd php ./custom.php


custom.php:

Code: Select all

<?php
/*
 * Assumed usage: /cmd track <folder>
 * Read input from input.prm. When you execute "/cmd track Racing", it will contain "track Racing"
 * Check if the command equals "track" and get the desired folder
 * (Optional: make an additional parameter for the number of tracks to be selected)
 * Get all files matching with *.trk in the desired folder and randomly select one or more
 * Write the track selection commands to custom.src.
 */
?>


example custom.src after execution (the quotes are important!):

Code: Select all

/tracks /add "banaring"
/tracks /add "luxuryng"


Now you can use things like /cmd track Racing in macros.ini. Hope I helped.

Post Reply