Control Train Via API

eddnerd

New member
Hi,
Is there a tutorial or guide on how to control a train via the API? I am hoping for a socket or something like that I can connect to that I can use to control throttle, brake, etc. And then read information like speed, brake pressure, grade, etc from Trainz.

Thanks,
Jake
 
Hi,
Is there a tutorial or guide on how to control a train via the API? I am hoping for a socket or something like that I can connect to that I can use to control throttle, brake, etc. And then read information like speed, brake pressure, grade, etc from Trainz.

Thanks,
Jake

You can buy a "Raildriver" unit that does this. It can be ordered from the Raildriver website.
 
Thanks, but isn't rail driver just a piece of hardware with a driver to connect it to Trainz. I'm looking for a way to write my own AI for an engineer.
 
You can control trains programmatically in TRS2004 GameScript scenarios, or in scenarios made with Trainz Pro Routes' SCS2004 (Scenario Creation System).

Unfortunately Auran removed the option to create scenarios in TRS2006 and later, but Trainz Pro Routes' SCS2006 can be used with TRS2006 and also TS2009. I don't know if it can be used with TC.

Both SCS2004 and SCS2006 are freeware.

There's an introductory step-by-step tutorial on making TRS2004 GameScript scenarios here, but being elementary it only covers the user controlling a train.

HTH, John
 
Hi,
Is there a tutorial or guide on how to control a train via the API? I am hoping for a socket or something like that I can connect to that I can use to control throttle, brake, etc. And then read information like speed, brake pressure, grade, etc from Trainz.

Thanks,
Jake

Hi Jake,

Auran has asked if there was interest in having a API available in the past. I don't know what the plans are at the moment. The best place to ask would be over at http://www.trainzdev.com The lead programmer is Chris (windwalkr). He would be interested in your ideas.

William
 
TRS2004 owners have the API, it's C:\Program Files\Auran\TRS2004\Scripts\docs\index.chm

A version for TRS2006 can be downloaded (sorry I don't have the link). It's very similar, just a few additional functions. AFAIK there isn't a TS2009 version yet but most of the old functions should still work.

John
 
Back
Top