PDA

View Full Version : About timeout in scripts



pguy
August 16th, 2015, 10:41 AM
Hi.

I am currently tracking some timeout problems in DriveToStation and NavigateToStation driver commands script. Several users are complaining about timeouts under Tane that they did not had under TS2012. I know that there is an issue with routes with many passenger stations. But I have a question for Chris : does the threshold for timeout in script is the same in TANE than in TS2012, or has it been reduced for surely some good reason ? I am currently wondering why this problem linked to the number of passenger stations scanned is now happening under Tane and not under TS2012 with the same script code for the command.

For people interested about this problem, the problem seems to happen in current driver commands version when there are more than 60 stations in the route. I have already a new version of the script code rewritten to optimize what is done during the scan, which works when there is less than 140 stations in a route. And I have also a new version in development, which suppress the stations scan for precaching some information used by the the driver commands, but this still need some work and testing as it change a lot the logic behind in the driver commands.

Regards.
Pierre.

norfolksouthern37
August 16th, 2015, 11:47 AM
the threshold may not be the entire problem. I was experiencing several timeouts related to a Sleep() statement that was using a variable from the config for the sleep time. This may not be related to your problem but it is worth a shot to check it out. What I found out is that a statement like


if(!variable) variable = 10;

does not function properly in TANE and is a product of two unrelated issues with the script vm under 64 bit according to Chris. I am sure they will correct it very soon.

In my case as a result the required Sleep() statement was being passed a 0.0 and did not sleep at all, causing the loop to run out of control until a timeout exception stopped it.

at this time though the only way to ensure something like that works is


if(variable == 0) variable = 10;


again sorry if this does not directly address your problem but I hoped it may give an idea as to why the same script code causes a timeout where it did not before. There may yet be more undiscovered issues lurking in the script system.

WindWalkr
August 16th, 2015, 06:54 PM
does the threshold for timeout in script is the same in TANE than in TS2012, or has it been reduced for surely some good reason ?

Yes, it's definitely reduced. The previous limit was quite high because it was a completely new check and we didn't want to break anything except the very worst performing scripts (or outright hangs.) We've brought this down to something a little more reasonable in T:ANE, so some scripts which didn't hit the limit in TS12 will now do so.

The intention here is to reduce the number of FPS stalls caused by script, and the amount of startup time consumed by script. There are inevitably efficient and inefficient ways of achieving any task. The limit ensures that any inefficient techniques are removed from the game and replaced with more efficient equivalents.

I don't expect that we'll reduce the general limit again in the future, since T:ANE brings it to something fairly reasonable, however this are a few areas of concern where many scripts are being fired off in quick succession (such as showing the Driver Command menu) that currently allow the full limit for each script execution rather than for the combined effort. We will be reviewing this in the future to ensure that it's not causing problems.

chris

WindWalkr
August 16th, 2015, 06:57 PM
What I found out is that a statement like


if(!variable) variable = 10;

does not function properly in TANE

Just a clarification on this- this is only one of the two parts required to trigger a fault, so won't fail in isolation. However, the workaround that norfolksouthern37 suggests is reliable so if you suspect that you're having trouble with it, it's a good idea to try this.

chris