AI Rule ideas only drive during a certain time? / check time rule?

Edited: to better explain the rule.

I have created a large route which only runs mainly repeating clockface AI schedules with a couple of extra morning and evening rush hour trains + timetabled freight services. And was wondering if a certain driver command exists to do the following:

Wait until between Time A and Time B. (Only drive if between 7am and 11pm)

Example:
At the beginning of the session the train starts in Station A
The trains driver commands would be as follows:

> Wait Until between (7am) and (11pm)
> Drive to station B,
> Load
> Drive to station C,
> Unload
> Terminate train
> Drive to station B,
> Load
> Drive to station A,
> Unload
> Terminate train
> Repeat


If I set the session to begin at 6am the train would remain stationary in Station A until 7am, then continue with its schedule.
If I set the session to begin at 7am or 8am the train would start its schedule and depart Station A straight away without waiting because time time is between 7am and 11pm.
If I set the session to begin at 10pm the train would start its schedule straight away and depart Station A. After the train drives to its destination (Station C) and returns to Station A again the time would likely be after 11pm meaning the Wait Until between (7am) and (11pm) command would take affect. The train will now wait in Station A until the following morning until 7am and continue on its schedule.

I have tried using the wait until hour rule (set to 7am), which works fine if I start the session at before 7am - but if I start the session at 8am the train will wait until the next 7am the following day.
 
Last edited:
This would be a great rule as I have tried to run similar service on my own routes. Where we live, we have a similar commuter and freight schedule with the last train at midnight... There's nothing like running for the last train out of Boston only to miss it by 2 minutes!

I was going to suggest the wait until, but apparently that didn't work quite as planned. The alternative I can think of is to setup a scenario script using SCS. This is a scripting system, which I'm not sure is available yet for TS12, that allows crafting up things like this with its conditional looping capabilities. I have never used it, and it was originally developed for TRS2006, but there has been a new version for TS12 in beta with reports in the forums.

John
 
Hi

As John says it is possible to do this with the SCS2013 rule as this contains conditional commands which would allow you to only operate the schedule when the conditions of the If command were met. If this interests you then have a look at this thread http://forums.auran.com/trainz/show...ike-to-try-SCS2013-for-TS12&highlight=scs2013

It has a steep learning curve but once you've mastered it you can have the AI making all sorts of decisions for itself by combining variables with conditional commands.

Regards

Brian
 
I believe there is a wait till time command but I will have to look it up later since I do not have trainz on this computer. Will post my findings tonight
 
Hi Lewiscc65,

I have tried the wait until command, but if I start the session after the time it will wait until the next day to continue driving. Its more of a wait until any time between Time A and Time B. Say 6am and 11pm meaning if I start the session at 3am the train will wait until 6am and start driving, but if I start the session at 6pm the train will start driving straight away.
 
I don't think that rule will work. If I use Wait Until Time (7am) the train will only depart at 7am, The driver schedule is set to repeat and the Wait Until Time (7am) will display again meaning the train will only run once every 24 hours. I appreciate your help. Thanks :)

---

Updated Description

Example:
At the beginning of the session the train starts in Station A
The trains driver commands would be as follows:

> Wait Until between (7am) and (11pm)
> Drive to station B,
> Load
> Drive to station C,
> Unload
> Terminate train
> Drive to station B,
> Load
> Drive to station A,
> Unload
> Terminate train
> Repeat


If I set the session to begin at 6am the train would remain stationary in Station A until 7am, then continue with its schedule.
If I set the session to begin at 7am or 8am the train would start its schedule and depart Station A straight away without waiting because time time is between 7am and 11pm.
If I set the session to begin at 10pm the train would start its schedule straight away and depart Station A. After the train drives to its destination (Station C) and returns to Station A again the time would likely be after 11pm meaning the Wait Until between (7am) and (11pm) command would take affect. The train will now wait in Station A until the following morning until 7am and continue on its schedule.
 
Have you looked at QuickPortalManager? yes you would have to put a portal on the route but it can be used to emit a train on a daily bases at given times and days of the week.
 
Hi again

It is obvious that what's needed is a conditional rule or command to restrict the times that the train can run. I know that there are variables that can be set up, altered and checked by rules although I have never used them. Perhaps someone who has could tell us if there is any way to use them conditionally?

Regards

Brian
 
Back
Top