/add /remove cars in macros.ini

Discussion related to Turbo Sliders and beta version feedback.

Moderator: Forum Moderators

Post Reply
lux2
Community User Level: 2
Community User Level: 2
Posts: 221
Joined: Mon Dec 29, 2008 7:22 pm
Location: Parma - Italy

/add /remove cars in macros.ini

Post by lux2 » Sat Apr 16, 2011 3:51 pm

Hello, I'm maybe coming with a newbie/stupid question... :? :wink:

If I start a server with this lines in macros.ini:
/fixedcar 1
/fixedcar 0
/cars /add car1
/cars /add car2
/cars /remove Easyslider
/cars /remove Spinner
/cars /remove Speeder
/cars /remove Antislider
/cars /remove slider


The result is that i have server with 4 cars: car1, car2, anti and slider

If, for example, I change the lines in this way:
/fixedcar 1
/fixedcar 0
/cars /remove Speeder
/cars /remove Antislider
/cars /remove slider
/cars /remove Easyslider
/cars /add car1
/cars /remove Spinner


This results in a server with 2 cars: car1 and spinner.

With any other mix of lines, it always seems that only first 5 lines of add/remove are considered. This has no sense.

Where am I wrong? :?

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 » Sat Apr 16, 2011 11:06 pm

It sounds very strange to me. I didn't have time to reproduce this bug yet, but I believe you can try different solutions, such as using an external src file to set everything up. You could try to run it manually from the server, and then include it in the macros.ini with a call of /src srcname...

:roll:

lux2
Community User Level: 2
Community User Level: 2
Posts: 221
Joined: Mon Dec 29, 2008 7:22 pm
Location: Parma - Italy

Post by lux2 » Sun Apr 17, 2011 8:02 am

This mistery is growing :?

I started from the macros.ini created by jazzy's tool and the problem was already there.
I tried to change the /cars lines without success.

Then, I moved the "/cars lines" before the "/tracks lines" and... the cars are now OK but I have only 24 tracks instead of 26. :shock:
Last 2 tracks are missed. Bah...

This is the macros.ini:

Begin Reg
/info TSB-F2 TEST SERVER
/autotime /reg 15
/autotime /cup 30
/autotime /car 9
/autotime /raceinit 30
/autotime /raceend 5
/autotime /raceidle 72
/autotime /cupend 10
/addadmin ALL ************
/aifill 6
/aiskill 5
/maxplayers 12
/laps 5
/order 0
/adminmsg hello
/fixedcar 1
/fixedcar 0
/cars /add TSB-F2
/cars /add moto-x
/cars /remove Easyslider
/cars /remove Spinner
/cars /remove Antislider
/cars /remove Speeder
/cars /remove slider
/points 1 10 8 6 5 4 3 2 1 0 0
/tracks /clear
/tracks /add JA_Fisherman's-Bay
/tracks /add de_Anery
/tracks /add pu_Costa_del_Puna
/tracks /add k-Siltala
/tracks /add de_Cazzis
/tracks /add de_Spair
/tracks /add Et_Halstead
/tracks /add Sc_Piharatani
/tracks /add Sc_Metsamaa
/tracks /add Sc_Shortis
/tracks /add J_Inwoken
/tracks /add iB_Laikka-fix
/tracks /add Sc_Gogobay
/tracks /add de_Plore
/tracks /add k-Atacama
/tracks /add iB_Nordschleife!
/tracks /add Sc_Aspeed
/tracks /add Sc_Scluiba
/tracks /add Sc_Artami
/tracks /add Jn_Proteus-long
/tracks /add Jn_Thanatos
/tracks /add Sc_ArseRing2
/tracks /add Sc_Antila
/tracks /add Sc_Clarityre
/tracks /add Sc_Antiloop
/tracks /add Sc_DeRivate

End

EDIT: I moved, as you suggested, the red lines in a separate file and... it works!
I still don't understand why macros.ini does not work.
Everithing seems easy.
My "hello world!" in TS scripting seems to be more difficult than expected.

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 » Sun Apr 17, 2011 12:32 pm

lux2 wrote:EDIT: I moved, as you suggested, the red lines in a separate file and... it works!
I still don't understand why macros.ini does not work.

Maybe there's a limit.. use separate source files then ;)

lux2
Community User Level: 2
Community User Level: 2
Posts: 221
Joined: Mon Dec 29, 2008 7:22 pm
Location: Parma - Italy

Post by lux2 » Fri Apr 29, 2011 3:34 pm

Today I tried to do some other steps.
My goal was to randomly extract some tracks from a list, to write this tracks (adding /tracks /add...) in a .src file and to load it.
I'm actually trying with Windows.

All seemed to go in a good way, the script worked well but... only running it by command line (also running it in a .bat works).

The problem is that nothing happens calling the script from the game (or from a .src) by /cmd.
I created a .bat that contains mypath/php.exe myscript.php, I typed /cmd mybat.bat, input.prm was filled with mybat.bat and... nothing happened. The game continued without running myscript.

I read the manual where it says "... it is also possible to define custom
script file which is automatically executed with command '/cmd'.
If scripts are on, the file is by default "custom.cmd". All parameters
given are written to file "input.prm" and the name of that file is also
given as a parameter to the script
. After the execution of the script
has ended, source file "custom.src" is run and removed if found.
", I also read what dede told me one night some time ago but... I'm stuck.

I maybe don't really understand how the scripting "flow" works and I miss some step. I feel the words in red could be the core of my "bug".

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

Post by Tijny » Fri Apr 29, 2011 4:01 pm

That's expected behavior. If you type /cmd mybat.bat it won't actually run mybat.bat (if that were the case, it would present a few nasty security holes) - instead, it will run the script defined as the CustomCmd in sliders.ini, which is custom.cmd by default. So, in your case you could do:
sliders.ini wrote:CustomCmd mybat.bat

Your PHP script can then read input.prm and decide what it needs to do in case you want to define multiple custom commands. For example, typing /cmd cheese should produce different results than /cmd cake.

lux2
Community User Level: 2
Community User Level: 2
Posts: 221
Joined: Mon Dec 29, 2008 7:22 pm
Location: Parma - Italy

Post by lux2 » Fri Apr 29, 2011 4:46 pm

Thank you Tijny, I hope to have got it right this time :oops:

I'll try this evening to make my script runing and I'll start to think how to manage "everything I will want" by a single php script.

EDIT: yes, it works now :D

Post Reply