Global
Global scripts are invoked by the Document.RunGlobalScripts
script statement, usually in a script Init function, for example:
Init()
{
debug.clear();
debug.printL("Global change script running");
Document.RunGlobalScripts();
debug.printL("Global change script finished");
}
This runs any global script functions defined in the script, for example the function OnGlobalLink
, if defined, will be called for every link in the layout.
2 Entry Points
OnGlobalLink()
This function is called for every Link in the layout.
The variable Link
is set and represents the link in question.
For example:
OnGlobalLink()
{
Link.SetDarkness(0);
Link.SetLit(0);
Link.SetSmoke(0);
}
OnGlobalNode()
This function is called for every Node in the layout.
The variable Node
is set and represents the node in question.
OnGlobalTrain()
This function is called for every Train in the layout.
The variable Train
is set and represents the train in question.
OnGlobalSignal()
This function is called for every Signal in the layout.
The variable Signal
is set and represents the node in question.
import