<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.trainzsimulator.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonies</id>
	<title>TrainzOnline - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.trainzsimulator.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonies"/>
	<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/wiki/Special:Contributions/Jonies"/>
	<updated>2026-11-05T04:54:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_Train&amp;diff=44861</id>
		<title>Class Train</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_Train&amp;diff=44861"/>
		<updated>2025-08-08T08:42:08Z</updated>

		<summary type="html">&lt;p&gt;Jonies: /* GetAutopilotMode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**[[Class GSObject|GSObject]] *&lt;br /&gt;
***[[Class GameObject|GameObject]]&lt;br /&gt;
****Train&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*A train is a collection of vehicles in TRS.&lt;br /&gt;
*They act as a single entity and may be controlled using this class.&lt;br /&gt;
*A train is placed on a track in script by using [[Class World#CreateTrain|World.CreateTrain()]] or [[Class TrainUtil#CreateTrainFromSoup|TrainUtil.CreateTrainFromSoup()]]. &lt;br /&gt;
*Trainz will automatically create a Train object for each consist that appears in the game.&lt;br /&gt;
*When an existing train is uncoupled and split up into two separate consists a new train object is created.&lt;br /&gt;
*Similarly when two trains couple one of the train objects is destroyed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Messages==&lt;br /&gt;
*Messages sent to and from Train objects are listed below:&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=50%|margin=15px}}&lt;br /&gt;
|-&lt;br /&gt;
|bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Major&#039;&#039;&#039;||bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Minor&#039;&#039;&#039;||bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Source&#039;&#039;&#039;||bgcolor=&amp;quot;#EEEEEE&amp;quot; |&#039;&#039;&#039;Destination&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|Schedule||Abort||Train||Train  &lt;br /&gt;
|-&lt;br /&gt;
|Schedule||Complete||Train||Broadcast  &lt;br /&gt;
|-&lt;br /&gt;
|Schedule||Touch||Train||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||Deleted||Train||&lt;br /&gt;
|-&lt;br /&gt;
|[[Signal Messages|Train]]||Entered red signal notify||Train||Broadcast  &lt;br /&gt;
|-&lt;br /&gt;
|[[Signal Messages|Train]]||Entered red signal||Signal||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Train]]||EnterTrack||Track||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Train]]||InnerEnterTrack||Track||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Train]]||InnerLeaveTrack||Track||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Train]]||LeaveTrack||Track||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||Over advisory speed limit||Train||Broadcast  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||Over floating speed limit||Train||Broadcast  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||Over speed limit||Train||Broadcast  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||ReachedTarget||Train||Train&lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||SlowingForTarget||Train||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||StartedMoving||Train||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||StoppedMoving||Train||Train  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||Under advisory speed limit||Train||Broadcast  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||Under floating speed limit||Train||Broadcast  &lt;br /&gt;
|-&lt;br /&gt;
|[[Train Messages|Train]]||Under speed limit||Train||Broadcast  &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Train Control Modes===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CONTROL_MANUAL = 1||User controls train, script can change settings.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CONTROL_AUTOPILOT = 2||Autopilot controls train.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CONTROL_AUTOMANUAL = 3||User controls train, autopilot takes over when train is not currently &#039;focused&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CONTROL_SCRIPT = 4||Only the script can control the train.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Train Physics Modes===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int PHYSICS_DCC = 1||DCC mode. &lt;br /&gt;
|-&lt;br /&gt;
|public define int PHYSICS_SIMULATION = 2||Cab mode.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Reverser Traction Modes===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int TRACTION_FORWARD = 2||Reverse is in forward setting.&lt;br /&gt;
|-&lt;br /&gt;
|public define int TRACTION_NEUTRAL = 1||Reverser is in neutral.&lt;br /&gt;
|-&lt;br /&gt;
|public define int TRACTION_REVERSE = 0||Reverser is in reverse.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Train Brake Modes===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define float  TRAIN_BRAKE_RELEASE = 0.0||Train brakes are released.&lt;br /&gt;
|-&lt;br /&gt;
|public define float  TRAIN_BRAKE_INITIAL = 1.0||Train brakes are in initial mode.&lt;br /&gt;
|-&lt;br /&gt;
|public define float  TRAIN_BRAKE_APPLICATION = 2.0||Train brakes are applied.&lt;br /&gt;
|-&lt;br /&gt;
|public define float  TRAIN_BRAKE_HANDLE_OFF = 3.0||Train brake handle is off.&lt;br /&gt;
|-&lt;br /&gt;
|public define float  TRAIN_BRAKE_EMERGENCY = 4.0||Train brakes are in emergency stop position.&lt;br /&gt;
|-&lt;br /&gt;
|public define float  TRAIN_BRAKE_LAP = 5.0||Train brakes are in the lap position, not available for all trains.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Dynamic Brake States===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  DYNAMIC_BRAKE_TRACTION = 0||Dynamic brakes in traction mode.&lt;br /&gt;
|-&lt;br /&gt;
|public define int  DYNAMIC_BRAKE_NEUTRAL = 1 ||Dynamic brakes in neutral.&lt;br /&gt;
|-&lt;br /&gt;
|public define int  DYNAMIC_BRAKE_BRAKE = 2 ||Dynamic brakes are on.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Found Results===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  RESULT_NONE = 0||Item not found.&lt;br /&gt;
|-&lt;br /&gt;
|public define int  RESULT_FORWARD = 1||Item is in front of train.&lt;br /&gt;
|-&lt;br /&gt;
|public define int  RESULT_INSIDE = 2||Item is within the train, ie between the front and the rear limits.&lt;br /&gt;
|-&lt;br /&gt;
|public define int  RESULT_BACKWARD = 3||Item is behind the train.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===Measurement Conversion Multipliers===&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define float  KPH_TO_MPS = 0.278||Kilometres per hour -&amp;gt; Metres per second.&lt;br /&gt;
|-&lt;br /&gt;
|public define float  MPH_TO_MPS = 0.447||Miles per hour -&amp;gt; Metres per second.&lt;br /&gt;
|-&lt;br /&gt;
|public define float  MPH_TO_KPH = 1.609||Miles per hour -&amp;gt; Kilometres per hour.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Members==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|&amp;lt;b&amp;gt;public Browser timeTableInfo&amp;lt;/b&amp;gt;||A publicly accessible Browser object for timetable information.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
==Methods==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===AddVelocity===&lt;br /&gt;
{{MethodHeader|public native void AddVelocity(float velocity)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;velocity&#039;&#039;&#039; = Velocity to add to the current speed of the train.		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.AddVelocity(5.0);	&lt;br /&gt;
;Notes&lt;br /&gt;
*Velocity parameter must be in metres per second and may be negative.&lt;br /&gt;
*Use the [[#Measurement Conversion Multipliers|Measurement Conversion Multipliers]] to convert from other units.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ClearTrainTimetable===&lt;br /&gt;
{{MethodHeader|public void ClearTrainTimetable(ScenarioBehavior rule)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;rule&#039;&#039;&#039; = rule that called [[#SetTrainTimetable|SetTrainTimetable()]] on this train.		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.ClearTimeTable(timetableRule);	&lt;br /&gt;
;Notes&lt;br /&gt;
*Clears the train timetable of this train. 	&lt;br /&gt;
*Having cleared the TrainTimetable, it is now safe again to set another TrainTimetable for this train through [[#SetTrainTimetable|SetTrainTimetable()]].&lt;br /&gt;
*This method must only be called by the rule which called SetTrainTimetable() in the first place. &lt;br /&gt;
*It is the responsibility of the caller to post a (TrainTimetable, Touch) message after calling this function.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===DecTrainBusy===&lt;br /&gt;
{{MethodHeader|public void DecTrainBusy(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.DecTrainBusy();	&lt;br /&gt;
;Notes&lt;br /&gt;
*Decrements this train&#039;s busy count.&lt;br /&gt;
*See [[#IsTrainBusy|IsTrainBusy()]] for further details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Derail===&lt;br /&gt;
{{MethodHeader|public native void Derail(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.Derail();	&lt;br /&gt;
;Notes&lt;br /&gt;
*Deliberately derails the train.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===EnablePhysics===&lt;br /&gt;
{{MethodHeader|public native void EnablePhysics(bool enable)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;enable&#039;&#039;&#039; = True to enable physics calculations for this train, false to disable		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.EnablePhysics(false);		&lt;br /&gt;
;Notes&lt;br /&gt;
*Turning physics off for scenic rolling stock that the player cannot interact with can boost performance.&lt;br /&gt;
*There is no point in doing physic calculations for idle rollingstock.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetActiveDriver===&lt;br /&gt;
{{MethodHeader|public native DriverCharacter GetActiveDriver(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The active driver of this train, null if there is no driver assigned.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter driver = train.GetActiveDriver();		&lt;br /&gt;
;Notes&lt;br /&gt;
*There may be more than one driver on a train but there is only one active driver and an individual Locomotive may only have one driver assigned.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetAdvisoryLimit===&lt;br /&gt;
{{MethodHeader|public native float GetAdvisoryLimit(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current advisory speed limit set by script.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 float speed = train.GetAdvisoryLimit();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetAllowsUserContol===&lt;br /&gt;
{{MethodHeader|public native bool GetAllowsUserControl(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if this train allows the user to control it directly through DCC or Cabin interfaces, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool canDrive =train.getAllowsUserControl();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetAutopilotMode===&lt;br /&gt;
{{MethodHeader|public native int GetAutopilotMode(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Train Control Modes|Train Control Mode]] constants defining the method by which the train is currently controlled.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int controlMode = train.GetAutopilotMode();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetAutopilotStopJunctionBase===&lt;br /&gt;
{{MethodHeader|public native JunctionBase GetAutopilotStopJunctionBase(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The junction object that is preventing the autopilot from taking this train any further, null if the train is not stopped by a junction.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 JunctionBase junction = train GetAutopilotStopJunctionBase();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetAutopilotStopTrain===&lt;br /&gt;
{{MethodHeader|public native Train GetAutopilotStopTrain(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The train that is preventing the autopilot from taking this train any further, null if the train is not being held up by another train.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train otherTrain = train.GetAutopilotStopTrain();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetAutopilotTargetSlowing===&lt;br /&gt;
{{MethodHeader|public native bool GetAutopilotTargetSlowing(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the autopilot is slowing down for its target destination, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool isSlowing = train.GetAutopilotTargetSlowing();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetDCCThrottle===&lt;br /&gt;
{{MethodHeader|public native float GetDCCThrottle(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The DCC throttle setting for this train when using DCC physics.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 float throttle = GetDCCThrottle();		&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned value will be in the range [-1.0 .. 1.0] where -1.0 is full throttle in reverse, 0.0 is stationary and 1.0 is full throttle forward.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetFrontmostLocomotive===&lt;br /&gt;
{{MethodHeader|public native Locomotive GetFrontmostLocomotive(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a reference to the frontmost locomotive in the train.	&lt;br /&gt;
;Syntax&lt;br /&gt;
 Loco = Train.GetFrontmostLocomotive();	&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;The &#039;&#039;front&#039;&#039; of the train is defined relative to the train&#039;s current heading.??&amp;lt;/font&amp;gt;	&lt;br /&gt;
*The train&#039;s heading may not correspond to its physical appearance and can change during game play.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetHeadlightState===&lt;br /&gt;
{{MethodHeader|public native bool GetHeadlightState(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if headlights are turned on, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool lights = train.GetHeadlightState();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Only the frontmost locomotive will display headlighs.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetLastVisitedBuildable===&lt;br /&gt;
{{MethodHeader|public Buildable GetLastVisitedBuildable(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The last [[Class Buildable|Buildable]] object visited by this train, null if there have been no such visits.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Buildable buildable = train.GetLastVisitedBuildable();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetLastVisitedIndustry===&lt;br /&gt;
{{MethodHeader|public Industry GetLastVisitedIndustry(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The last Industry object visited by this train, null if there have been no such visits.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 Industry industry = train.GetLastVisitedIndustry();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetLastVisitedTrack===&lt;br /&gt;
{{MethodHeader|public Track GetLastVisitedTrack(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The last track segment visited by this train.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 Track track = train.GetLastVisitedTrack();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Note that the returned value may be null. &amp;lt;font color=red&amp;gt;How is that possible?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetHighBeams===&lt;br /&gt;
{{MethodHeader|public bool GetHighBeams(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the frontmost locomotive&#039;s high beams are on, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool High_Lights = train.GetHighBeams();		&lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[Class Vehicle#GetHighBeams|Vehicle.GetHighBeams()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetMaximumCouplingStressVehicle===&lt;br /&gt;
{{MethodHeader|public native Vehicle GetMaximumCouplingStressVehicle(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The Vehicle in this consist that is experiencing the greatest level of coupling stress.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 Vehicle vehicle = GetMaximumCouplingStressVehicle();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetPantographState===&lt;br /&gt;
{{MethodHeader|public native int GetPantographState(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The state of the pantographs of the electric locomotives in this train.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 int pantoState = train.GetPantographState();		&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned value will be in the range [0..3] where:&lt;br /&gt;
**0 = Both pantographs down.&lt;br /&gt;
**1 = Front pantograph up.&lt;br /&gt;
**2 = Rear pantograph up.&lt;br /&gt;
**3 = Both pantographs up.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetPhysicsModel===&lt;br /&gt;
{{MethodHeader|public native int GetPhysicsModel(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The mode of control chosen by the player to drive the locomotive		&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Mode = train.GetPhysicsModel();		&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned value will be :&lt;br /&gt;
**2 = CabinControl&lt;br /&gt;
**1 = DCCMode&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===GetSmoothedVelocity===&lt;br /&gt;
{{MethodHeader|public native float GetSmoothedVelocity(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a smoothed velocity, intended for human consumption.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 float speed = train.GetSmoothedVelocity();		&lt;br /&gt;
;Notes&lt;br /&gt;
*If you require an accurate velocity readout for physics operations, use [[#GetVelocity|GetVelocity()]].&lt;br /&gt;
*&#039;&#039;In practice, even when the train stops completely, it does not report an absolute zero.&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetSpeedLimit===&lt;br /&gt;
{{MethodHeader|public native float GetSpeedLimit(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current sign posted speed limit. 		&lt;br /&gt;
;Syntax&lt;br /&gt;
 float permittedSpeed = train.GetSpeedLimit();		&lt;br /&gt;
;Notes&lt;br /&gt;
*The speed limit is dependent on trackside signs placed in Surveyor as well as the direction of the train.&lt;br /&gt;
*A default value applies to track that isn&#039;t sign posted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetTrackmarkDirection===&lt;br /&gt;
{{MethodHeader|public native int GetTrackmarkDirection(TrackMark mark)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mark&#039;&#039;&#039; = A reference to the Trackmark to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* One of the [[#Found Results|Found Result]] values representing the location of the given track mark relative to this train.			&lt;br /&gt;
;Syntax&lt;br /&gt;
 int location = train.GetTrackmarkDirection(trackmark);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetTrainBrakes===&lt;br /&gt;
{{MethodHeader|public native float GetTrainBrakes(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Train Brake Modes|Train Brake mode]] constants indicating the current state of this train&#039;s brakes.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 float brakeState = train.GetTrainBrakes();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetTrainDisplayName===&lt;br /&gt;
{{MethodHeader|public native string GetTrainDisplayName(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A localised display name for this train. 		&lt;br /&gt;
;Syntax&lt;br /&gt;
 string trainName = train.GetTrainDisplayName();		&lt;br /&gt;
;Notes&lt;br /&gt;
*This will be a name Trainz has created for the consist such as &amp;quot;Consist 0&amp;quot; and will match the description shown in the Minimap view. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetTrainPriorityNumber===&lt;br /&gt;
{{MethodHeader|public native int GetTrainPriorityNumber(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Train priority value in the range [1 .. 3]		&lt;br /&gt;
;Syntax&lt;br /&gt;
 int priority = train.GetTrainPriorityNumber();&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[#SetTrainPriority|SetTrainPriority()]] for further details.		&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetTrainTimetable===&lt;br /&gt;
{{MethodHeader|public TrainTimetable GetTrainTimetable(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The TrainTimetable that the train is currently using, null if there is none.&lt;br /&gt;
;Syntax&lt;br /&gt;
  TrainTimetable timetable = train.GetTrainTimetable();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetTrainVelocity===&lt;br /&gt;
{{MethodHeader|public native float GetTrainVelocity(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The train&#039;s current velocity in metres per second.&lt;br /&gt;
;Syntax&lt;br /&gt;
  float speed = train.GetTrainVelocity();		&lt;br /&gt;
;Notes&lt;br /&gt;
* This function provides the instantaneous velocity for vehicles in this train, which is good for physics calculations but not good for human-readable display.  If you want human-readable display, use [[#GetSmoothedVelocity|GetSmoothedVelocity()]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===GetVehicles===&lt;br /&gt;
{{MethodHeader|public native Vehicle[ ] GetVehicles(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns an array consisting of all the vehicles making up this train.	&lt;br /&gt;
;Syntax&lt;br /&gt;
 Vehicle[] vehicles = train.GetVehicles();	&lt;br /&gt;
;Notes&lt;br /&gt;
 *GetVehicles[0] is always the front vehicle of the train relative to the train&#039;s current heading.	&lt;br /&gt;
*The train&#039;s heading may not correspond to its physical appearance and can change during game play.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetVelocity===&lt;br /&gt;
{{MethodHeader|public native float GetVelocity(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The train&#039;s current velocity.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 float speed = train.GetVelocity();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Warning!  The TS10 and TS12 Train.gs scripts advise this method is buggy and to use [[#GetSmoothedVelocity|GetSmoothedVelocity()]] or [[#GetTrainVelocity|GetTrainVelocity()]] instead.&lt;br /&gt;
*This function provides the instantaneous velocity for vehicles in this train, which is good for physics calculations but not good for human-readable display.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===HasReachedInnerJunctionRadius===&lt;br /&gt;
{{MethodHeader|public bool HasReachedJunctionInnerJunctionRadius(JunctionBase junction)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;junction&#039;&#039;&#039; = JunctionBase object to query.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if this train is within the inner radius of the given junction, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = train.HasReachedInnerJunctionRadius(junction10);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===HasTrainTimetable===&lt;br /&gt;
{{MethodHeader|public bool HasTrainTimetable(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if this train has an attached TrainTimetable, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool timed = train.HasTrainTimetable();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IsScheduleRunning===&lt;br /&gt;
{{MethodHeader|public bool IsScheduleRunning(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if this train is currently running to a Schedule, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool scheduled = train.IsScheduleRunning();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IsScheduleWindowVisible===&lt;br /&gt;
{{MethodHeader|public bool IsScheduleWindowVisible(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the schedule window for this train is currently open, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool windowOpen = IsScheduleWindowVisible();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IsStillInJunction===&lt;br /&gt;
{{MethodHeader|public bool IsStillInJunction(JunctionBase junction)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;junction&#039;&#039;&#039; = JunctionBase object to query.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the train holds a Permit for the given junction, flse otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool inJunction = train.IsStillInJunction(junction10);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IsStopped===&lt;br /&gt;
{{MethodHeader|public native bool IsStopped(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the train is currently stationary, false if it is in motion.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool moving=train.IsStopped();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IsTrainBusy===&lt;br /&gt;
{{MethodHeader|public bool IsTrainBusy(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the train&#039;s &#039;busy&#039; count is greater than zero, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool busy = train.IsTrainBusy();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Using the [[#IncTrainBusy|IncTrainBusy()]] method, any piece of script code can tag a train being busy. &lt;br /&gt;
*The train can be untagged later by calling DecTrainBusy(). &lt;br /&gt;
*This mechanism is mainly used by industries that are doing something with the train. &lt;br /&gt;
*A train can be tagged as being busy more than once by calling IncTrainBusy() multiple times so different industries can tag the train. &lt;br /&gt;
*Each time IncTrainBusy() is called, an internal busy count is incremented and if that busy count is greater than zero, the train is considered busy.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IsViewDetailsVisible===&lt;br /&gt;
{{MethodHeader|public bool IsViewDetailsVisible(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*true if the ViewDetails window for this train is visible, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool visible = train.IsViewDetailsVisible();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MapObjectIsInFront===&lt;br /&gt;
{{MethodHeader|public bool MapObjectIsInFront(MapObject obj, float range)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;obj&#039;&#039;&#039; = MapObject to search for.&lt;br /&gt;
*&#039;&#039;&#039;range&#039;&#039;&#039; = Maximum search distance.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the object is found within the specified distance and in front of the train, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool isClose = train.MapObjectIsInFront(terminus,100.0);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ReleaseTrackPermits===&lt;br /&gt;
{{MethodHeader|public void ReleaseTrackPermits(Permit[ ] permitList)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;permitList&#039;&#039;&#039; = Permit array containing a list of permits to release.		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.ReleaseTrackPermits(permitList);		&lt;br /&gt;
;Notes&lt;br /&gt;
*This method will release any permits from the &#039;&#039;permitList&#039;&#039; array that are currently held by this train.&lt;br /&gt;
*Any other permits in the array that are not held by this train will be ignored.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RunSchedule===&lt;br /&gt;
{{MethodHeader|public thread void RunSchedule(Schedule schedule, bool loop, float delay)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;schedule&#039;&#039;&#039; = The Schedule that the train is to follow.&lt;br /&gt;
*&#039;&#039;&#039;loop&#039;&#039;&#039; = False to run the schedule once, True to repeat it continuously.&lt;br /&gt;
*&#039;&#039;&#039;delay&#039;&#039;&#039; = Time in seconds to wait before starting the schedule.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.RunSchedule(schedule,false,10.0);		&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[Class Schedule|Schedule]] for information on how to build a schedule.&lt;br /&gt;
*Only one schedule may run on a train at a time and the user cannot control the train when it is running a schedule.&lt;br /&gt;
*This method is a thread, so the calling code does not need to wait for it to finish and return before executing other code.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetAdvisoryLimit===&lt;br /&gt;
{{MethodHeader|public native void SetAdvisoryLimit(float speed)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;speed&#039;&#039;&#039; = Speed limit to set in &amp;lt;del&amp;gt;KPH&amp;lt;/del&amp;gt; metres/second.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetAdvisoryLimit(60.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Sets an advisory speed limit for a script controlled train.&lt;br /&gt;
*Use zero in the speed parameter to clear any previously imposed limit.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Does this really use KPH, most similar methods use MPS&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Experimental evidence confirms that it&#039;s in m/s not kph or mph&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetAutopilotMode===&lt;br /&gt;
{{MethodHeader|public native void SetAutopilotMode(int mode)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Train Control Modes|Train Control Mode]] constants specifying the method by which this train is controlled.		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetAutopilotMode(Train.CONTROL_AUTOMANUAL);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetAutopilotTarget===&lt;br /&gt;
{{MethodHeader|public native void SetAutopilotTarget(Buildable buildable, string trigger)&amp;lt;br&amp;gt;public native void SetAutopilotTarget(Trackside trackside)&amp;lt;br&amp;gt;public native void SetAutopilotTarget(Track track)&amp;lt;br&amp;gt;public native void SetAutopilotTarget(JunctionBase junction)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;buildable&#039;&#039;&#039; = Buildable object to use as a destination.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Attached trigger within the buildable, specified by name.&lt;br /&gt;
*&#039;&#039;&#039;trackside&#039;&#039;&#039; =  Trackside object to use as a destination.&lt;br /&gt;
*&#039;&#039;&#039;track&#039;&#039;&#039; = Track segment to use as a destination.&lt;br /&gt;
*&#039;&#039;&#039;junction&#039;&#039;&#039; = JunctionBase object to use as a destination.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetAutopilotTarget(&amp;quot;Kings Cross Station&amp;quot;,&amp;quot;trigger1&amp;quot;);		&lt;br /&gt;
;Notes&lt;br /&gt;
*This method sets a destination for the autopilot to take this train to.&lt;br /&gt;
*Objects from respective child classes such as industries, signals and trackmarks may be specified.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetAutopilotTargetMinimumDistance===&lt;br /&gt;
{{MethodHeader|public native void SetAutopilotTargetMinimumDistance(float distance)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = The minimum distance in metres, between the train and the autopilot target, to be reached before the train will start to slow down.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train SetAutopilotTargetMinimumDistance(100.0);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetAutoPilotTargetMinimumSpeed===&lt;br /&gt;
{{MethodHeader|public native void SetAutopilotTargetMinimumSpeed(float speed)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;speed&#039;&#039;&#039; = Minimum speed, in metres per second, that the train should be travelling at when it reaches the Autopilot target.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetAutoPilotTargetMinimumSpeed(20.0);		&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;The documentation seems to mean that the train should be going at 20.0 OR MORE.  Shouldn&#039;t it be MaximumSpeed???&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetBail===&lt;br /&gt;
{{MethodHeader|public native void SetBail(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetBail();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Depresses the bail control for a short period.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetCouplingMask===&lt;br /&gt;
{{MethodHeader|public void SetCouplingMask(int mask)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mask&#039;&#039;&#039; = A mask specifying which of the trains exposed couplers are allowed to couple.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetCouplingMask(Vehicle.COUPLE_NONE); // prevents this train from coupling to another in Driver mode.&lt;br /&gt;
;Notes&lt;br /&gt;
*The mask can be built using the [[Class Vehicle#Coupler Flags|Coupler Flag]] constants defined in [[Class Vehicle]].&lt;br /&gt;
*This method will not prevent vehicles or trains from coupling in Surveyor, but takes effect in Driver mode.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetDCCThrottle===&lt;br /&gt;
{{MethodHeader|public native void SetDCCThrottle(float throttle)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;throttle&#039;&#039;&#039; = Float value in the range -1.0 .. 1.0 defining the throttle setting for the train when using DCC physics.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetDCCThrottle(0.0); //sets the throttle to neutral.		&lt;br /&gt;
;Notes&lt;br /&gt;
*Full speed ahead is 1.0&lt;br /&gt;
*Maximum in reverse is -1.0&lt;br /&gt;
*Neutral is 0.0&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetDecouplingMask===&lt;br /&gt;
{{MethodHeader|public void SetDecouplingMask(int mask)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mask&#039;&#039;&#039; = A mask specifying which of the couplers are allowed to couple, applies to all of the vehicles in the train.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetDecouplingMask(Vehicle.COUPLE_FRONT|Vehicle.COUPLE_BACK); // prevents vehicles being uncoupled from the train in Driver mode.&lt;br /&gt;
;Notes&lt;br /&gt;
*The mask can be built using the [[Class Vehicle#Coupler Flags|Coupler Flag]] constants defined in [[Class Vehicle]].&lt;br /&gt;
*This method will not prevent vehicles or trains from being uncoupled in Surveyor, but takes effect in Driver mode.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetDynamicBrakeMode===&lt;br /&gt;
{{MethodHeader|public native void SetDynamicBrakeMode(int mode)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*One of the [[#Dynamic Brake States|Dynamic Brake State]] constants indicating the current state of this train&#039;s brakes.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetDynamicBrakeMode(Train.DYNAMIC_BRAKE_TRACTION);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetFloatingLimit===&lt;br /&gt;
{{MethodHeader|public native void SetFloatingLimit(float delta, bool enable)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;delta&#039;&#039;&#039; = Tolerance allowed from the posted limit in metres per second.&lt;br /&gt;
*&#039;&#039;&#039;enable&#039;&#039;&#039; = Use true to enable messages related to floating limits, false to disable.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetFloatingLimit(5.0,true);		&lt;br /&gt;
;Notes&lt;br /&gt;
*Sets the floating speed limit level above the sign posted limit.&lt;br /&gt;
*The floating limit is an amount of tolerance above the current speed limit. &lt;br /&gt;
*Messages for floating speed violations are not to be confused with regular speed limit messages.&lt;br /&gt;
*The floating limit is monitored by the Scenario.Monitor() thread, and may be used for point deduction when speeding. It should therefore be reserved for player trains.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetHandBrake===&lt;br /&gt;
{{MethodHeader|public void SetHandBrake(bool state)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;state&#039;&#039;&#039; = Use true to apply the handbrake to all vehicles in this train which are not Locomotives, false to release the handbrake.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetHandBrake(true);		&lt;br /&gt;
;Notes &#039;&#039;The use of this function did not reveal any effect on the physics of trains.&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetHeadlightState===&lt;br /&gt;
{{MethodHeader|public native void SetHeadlightState(bool lightsOn)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;lightsOn&#039;&#039;&#039; = True to turn the headlights on, false to turn them off.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetHeadlightState(true);		&lt;br /&gt;
;Notes&lt;br /&gt;
*This method affects only the headlights on the frontmost locomotive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetHighBeams===&lt;br /&gt;
{{MethodHeader|public void SetHighBeams(bool value)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; = True to turn on high beams, false to turn them off.		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetHighBeams(true);		&lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[Class Vehicle#SetHighBeams|Vehicle.SetHighColor()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetLastVisitedBuildable===&lt;br /&gt;
{{MethodHeader|public void SetLastVisitedBuildable(Buildable buildable)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;buildable&#039;&#039;&#039; = Sets the last visited buildable to the given object.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetLastVisitedBuildable(KingsCrossStation);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetManualThrottle===&lt;br /&gt;
{{MethodHeader|public native void SetManualThrottle(int notch)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;notch&#039;&#039;&#039; = Value in the range 0 .. 8 to set the throttle.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetManualThrottle(5);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetPantogaphState===&lt;br /&gt;
{{MethodHeader|public native void SetPantographState(int state)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;state&#039;&#039;&#039; = Value in the range 0 .. 3 to set the pantographs if this train has them.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetPantographState(3);		&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of these values for &#039;&#039;state&#039;&#039;:&lt;br /&gt;
**0 = Both pantographs down.&lt;br /&gt;
**1 = Front pantograph up.&lt;br /&gt;
**2 = Rear pantograph up.&lt;br /&gt;
**3 = Both pantographs up.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetReverser===&lt;br /&gt;
{{MethodHeader|public native void SetReverser(int mode)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Reverser Traction Modes|Reverser Traction Mode]] constants defining the required state of the train&#039;s reverser lever.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetReverser(Train.TRACTION_REVERSE);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetTrainBrakes===&lt;br /&gt;
{{MethodHeader|public native void SetTrainBrakes(float mode)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Train Brake States|Train Brake State]] constants defining the required state of the train&#039;s brakes.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetTrainBrakes(Train.TRAIN_BRAKE_EMERGENCY);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetTrainPriorityNumber===&lt;br /&gt;
{{MethodHeader|public native void SetTrainPriority Number(int priority)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;priority&#039;&#039;&#039; = Priority value in the range 1 .. 3.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetTrainPriorityNumber(2);		&lt;br /&gt;
;Notes&lt;br /&gt;
*All trains and track sections can be assigned a priority value in the range of [1 - 3] with the default value being 2.&lt;br /&gt;
*The priority value is not a numerical scale of precedence, but a value for the AI driver to attempt to match.&lt;br /&gt;
*This means the driver will &#039;&#039;prefer&#039;&#039; track sections that have a priority equal to that of the train.&lt;br /&gt;
*Changing the priority of the train only takes affect when the driver restarts a new schedule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetTrainTimetable===&lt;br /&gt;
{{MethodHeader|public void SetTrainTimetable(TrainTimetable timetable)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;timetable&#039;&#039;&#039; = Assigns the specified timetable to this train.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetTrainTimetable(timetable);&lt;br /&gt;
;Notes&lt;br /&gt;
*This train must not already have a TrainTimetable assigned.&lt;br /&gt;
*To ensure that this proviso is met, use [[#ClearTrainTimetabel|ClearTrainTimetable()]] prior to calling this method.&lt;br /&gt;
*It is the responsibility of the caller to post a &amp;quot;TrainTimetable&amp;quot;,&amp;quot;Touch&amp;quot; message after calling this function.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetVelocity===&lt;br /&gt;
{{MethodHeader|public native void SetVelocity(float velocity)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;velocity&#039;&#039;&#039; = Velocity to apply to the train, in metres per second.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SetVelocity(0.0); // stops the train, subject to braking performance.		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ShowInConsistMenu===&lt;br /&gt;
{{MethodHeader|public native void ShowInConsistMenu(bool show)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;show&#039;&#039;&#039; = True to make this train visible to the in-game consist menu, false to hide it.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.ShowInConsistMenu(false);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SoundHorn===&lt;br /&gt;
{{MethodHeader|public native void SoundHorn(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.SoundHorn();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Sounds the horn or whictle for all locomotives in this train.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===StopSchedule===&lt;br /&gt;
{{MethodHeader|public void StopSchedule(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.StopSchedule();		&lt;br /&gt;
;Notes&lt;br /&gt;
*This method stops the Schedule this train is currently running (if any).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===StopScheduleAndWait===&lt;br /&gt;
{{MethodHeader|public void StopSchedule(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.StopSchedule();		&lt;br /&gt;
;Notes&lt;br /&gt;
*This method stops the Schedule this train is currently running (if any) and waits until the train&#039;s schedule actually stops before returning. &lt;br /&gt;
*If the train is not running a schedule, the method returns after broadcasting a &amp;quot;Schedule&amp;quot;,&amp;quot;Touch&amp;quot; message, in case someone is listening for schedule messages.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===StopTrainGently===&lt;br /&gt;
{{MethodHeader|public native void StopTrainGently(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.StopTrainGently();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Brings the train to a halt over a short time period.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===TakePermitOnTrack===&lt;br /&gt;
{{MethodHeader|public Permit[ ] TakePermitOnTrack(bool direction)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = Direction relative to the train in which to take out permits.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array including any permits taken which have not yet been granted to this train. Some of these permits may not yet have been granted. 		&lt;br /&gt;
;Syntax&lt;br /&gt;
 Permit[] permits = train.TakePermitOnTrack(true);		&lt;br /&gt;
;Notes&lt;br /&gt;
*Gets permits on the current track in the given direction.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===TestTrackPermit===&lt;br /&gt;
{{MethodHeader|public native bool TestTrackPermit(Permit permit, bool innerOnly)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;permit&#039;&#039;&#039; = An existing Permit object.&lt;br /&gt;
*&#039;&#039;&#039;innerOnly&#039;&#039;&#039; = If true the method will test only the inner radius, if false the default radius of 150 metres will be used.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if this train is within the track controlled by &#039;&#039;permit&#039;&#039;, false otherwise. 		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool ownPermit = train.TestTrackPermit(permit1,false);		&lt;br /&gt;
;Notes&lt;br /&gt;
*The method generates an exception if the &#039;&#039;permit&#039;&#039; parameter does not refer to a track.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToggleScheduleWindow===&lt;br /&gt;
{{MethodHeader|public void ToggleScheduleWindow(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.ToggleScheduleWindow();		&lt;br /&gt;
;Notes&lt;br /&gt;
*If the schedule window is already open/visible, this method will destroy it.&lt;br /&gt;
*Otherwise if the view details window is not visible, UpdateScheduleWindow() is called to create it for display.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ToggleViewDetailsWindow===&lt;br /&gt;
{{MethodHeader|public void ToggleViewDetailsWindow(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.ToggleViewDetailsWindow();		&lt;br /&gt;
;Notes&lt;br /&gt;
*If the ViewDetails window is already open/visible, this method will destroy it.&lt;br /&gt;
*Otherwise if the view details window is not visible, ViewDetails() is called to create it for display.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===TrackSearch===&lt;br /&gt;
{{MethodHeader|public native MapObject[ ] TrackSearch(bool direction, float distance)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = Direction to search relative to the train&#039;s heading, true for forwards, false for backwards.&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Maximum search distance in metres.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of objects found along the track in the defined search direction, the array might be empty.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 MapObject[] objects = train.TrackSearch(true,5000.0) // searches 5km forwards along the track.		&lt;br /&gt;
;Notes&lt;br /&gt;
*Gets all of the Trackside and SceneryWithTrack objects on a length of track that is either in front of or behind this train. &lt;br /&gt;
*Descendants of these classes are also returned.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===TracksideIsInFront===&lt;br /&gt;
{{MethodHeader|public bool TracksideIsInFront(Trackside obj, float range)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;obj&#039;&#039;&#039; = Trackside object to search for.&lt;br /&gt;
*&#039;&#039;&#039;range&#039;&#039;&#039; = Mximum search distance.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the object is logically forward of this train, false otherwise.		&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool found = train.TracksideIsInFront(signal1,500.0);		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Turnaround===&lt;br /&gt;
{{MethodHeader|public native void Turnaround(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.Turnaround();		&lt;br /&gt;
;Notes&lt;br /&gt;
*Reverses the logical direction of the train, ie changes its heading.&lt;br /&gt;
*The physical direction of the vehicles is not altered but the throttle direction is reversed.&lt;br /&gt;
*If the camera is focused on the train in tracking view when this method is called the camera&#039;s direction of view (relative to the map) will alter through 180 degrees.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===UpdateScheduleWindow===&lt;br /&gt;
{{MethodHeader|public void UpdateScheduleWindow(string vehicleName)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicleName&#039;&#039;&#039; = Name of vehicle within the train.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.UpdateScheduleWindow(&amp;quot;brake2&amp;quot;);		&lt;br /&gt;
;Notes&lt;br /&gt;
*Updates the schedule window from the given vehicle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===UpdateViewDetails===&lt;br /&gt;
{{MethodHeader|public void UpdateViewDetails(Vehicle vehicle)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = Reference to a vehicle within the train.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.UpdateViewDetails(vehicle);&lt;br /&gt;
;Notes&lt;br /&gt;
*Called by Vehicle.UpdateViewDetails() when a vehicle&#039;s load has changed so that the train&#039;s detail window can be amended.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===UpdateViewDetailsLocomotive===&lt;br /&gt;
{{MethodHeader|public void UpdateViewDetailsLocomotive(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.UpdateViewDetailsLocomotive(vehicle);&lt;br /&gt;
;Notes&lt;br /&gt;
*Called by Locomotive.UpdateViewDetails() when any of the Locomotive&#039;s operating parameters have changed so that the train&#039;s detail window can be amended.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ViewDetails===&lt;br /&gt;
{{MethodHeader|public void ViewDetails(Vehicle vehicle)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = Reference to a vehicle within the train.			&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None	&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.ViewDetails(vehicle);		&lt;br /&gt;
;Notes&lt;br /&gt;
*This method is called by Vehicle.ViewDetails() when the user has requested to view the details of the consist.&lt;br /&gt;
*It will create a Browser window listing information about the train including who the driver character is and the loads of all vehicles.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WasRunScheduleSuccessful===&lt;br /&gt;
{{MethodHeader|public bool WasRunScheduleSuccessful(void)}}	&lt;br /&gt;
;Parameters&lt;br /&gt;
*None		&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the most recently run schedule was successfully, false otherwise. 		&lt;br /&gt;
;Syntax&lt;br /&gt;
 train.WasRunScheduleSuccessful();		&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Examples==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
[[Class TrainUtil#AreInTrain|TrainUtil.AreInTrain()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class TrainUtil#CreateTrainFromSoup|TrainUtil.CreateTrainFromSoup()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class TrainUtil#IsInTrain|TrainUtil.IsInTrain()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class World#CreateTrain|World.CreateTrain()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class World#DeleteTrain|World.DeleteTrain()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class World#GetTrainList|World.GetTrainList()]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Jonies</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Keywords&amp;diff=44860</id>
		<title>TrainzScript Keywords</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Keywords&amp;diff=44860"/>
		<updated>2025-08-08T08:23:17Z</updated>

		<summary type="html">&lt;p&gt;Jonies: Fix The bThreadRunning status&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[TrainzScript Language Reference]]&lt;br /&gt;
** [[Comments &amp;amp; Delineation]]&lt;br /&gt;
** [[TrainzScript Keywords]]&lt;br /&gt;
** [[Operators]]&lt;br /&gt;
** [[Types]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
==Keywords==&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;break&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Exits from current code block (&#039;&#039;[[#for|for]], [[#wait|wait]], [[#switch|switch]], [[#while|while]]&#039;&#039;)&lt;br /&gt;
*Execution will continue with the first statement after the loop.&lt;br /&gt;
 // This loop will complete when n is greater than 5 or when n == list.size(), whichever occurs first&lt;br /&gt;
 for (n = 0; n &amp;lt; list.size(); ++n)&lt;br /&gt;
 {&lt;br /&gt;
   if (n &amp;gt; 5)&lt;br /&gt;
     break;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;case&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Individual &#039;&#039;case&#039;&#039; statements are labels that the code will jump to dependent on the value of the integer expression following the keyword.&lt;br /&gt;
*The case statement is used in the switch control flow statement to declare an integer option and the action to be taken when execution is transferred to this label.&lt;br /&gt;
*This code will print the days of the week from Sunday to Saturday:&lt;br /&gt;
 int i;&lt;br /&gt;
 string dayOfWeek;&lt;br /&gt;
 for(i = 0; i &amp;lt; 6; ++i)&lt;br /&gt;
 {&lt;br /&gt;
   switch(i)&lt;br /&gt;
   {&lt;br /&gt;
     case 0:&lt;br /&gt;
       dayOfWeek = &amp;quot;Sunday&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
     case 1:&lt;br /&gt;
       dayOfWeek = &amp;quot;Monday&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
     case 2:&lt;br /&gt;
       dayOfWeek = &amp;quot;Tuesday&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
     case 3:&lt;br /&gt;
       dayOfWeek = &amp;quot;Wednesday&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
     case 4:&lt;br /&gt;
       dayOfWeek = &amp;quot;Thursday&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
     case 5:&lt;br /&gt;
       dayOfWeek = &amp;quot;Friday&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
     case 6:&lt;br /&gt;
       dayOfWeek = &amp;quot;Saturday&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
     default:&lt;br /&gt;
       dayOfWeek = &amp;quot;ERROR&amp;quot;;&lt;br /&gt;
       break;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   Interface.Print(dayOfWeek);&lt;br /&gt;
 }&lt;br /&gt;
*&#039;&#039;[[#Switch|switch]]&#039;&#039; transfers execution to the statement immediately following the appropriate &#039;&#039;case&#039;&#039; label.&lt;br /&gt;
*If there is no match execution continues after the &#039;&#039;[[#default|default]]&#039;&#039; label.&lt;br /&gt;
*Note that the list of statements following the &#039;&#039;case&#039;&#039; selector should normally terminate with &#039;&#039;[[#break|break]];&#039;&#039; (which exits from the &#039;&#039;[[#switch|switch]]&#039;&#039; statement) or &#039;&#039;[[#return|return]]&#039;&#039; (which exits from the entire method) to prevent the code from running on into the next section.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;class&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Class defines a new class declaration and the identity of the immediate parent:&lt;br /&gt;
 class ChildClass isclass ParentClass&lt;br /&gt;
 {&lt;br /&gt;
 &lt;br /&gt;
  class members...&lt;br /&gt;
  class methods...&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
*More than one class declaration may be included in the same file.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;continue&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Jumps to the next iteration of a &#039;&#039;[[#for|for]], [[#while|while]]&#039;&#039; or &#039;&#039;[[#wait|wait]]&#039;&#039; loop For example:&lt;br /&gt;
 int i;&lt;br /&gt;
 for(i = 0; i &amp;lt; 10; ++i)&lt;br /&gt;
 {&lt;br /&gt;
   if (i == 5) &lt;br /&gt;
     continue;&lt;br /&gt;
   Interface.Print(i);&lt;br /&gt;
 }&lt;br /&gt;
*The above code will print 0 to 4, skip 5 and then print 6 to 9.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;default&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*See &#039;&#039;[[#case|case]]&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;define&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*&#039;&#039;define&#039;&#039; is used to declare a constant&lt;br /&gt;
*Constants must be initialised on declaration and cannot be changed in code.&lt;br /&gt;
 define string firstDay = &amp;quot;Monday&amp;quot;;  // declares a string variable available anywhere within the containing class&lt;br /&gt;
 define public int daysInWeek = 7;   // declares an integer variable which will also be available from outside the class.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;else&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*see &#039;&#039;[[#if|if]]&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;false&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Boolean constant&lt;br /&gt;
 !true = false&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;final&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*A class or method specifier that prevents users from overriding the declaration&lt;br /&gt;
 final class Info&lt;br /&gt;
 {&lt;br /&gt;
   string name;&lt;br /&gt;
   string address;&lt;br /&gt;
 }&lt;br /&gt;
*Given the above the declaration the following declaration would not be possible&lt;br /&gt;
 class DetailedInfo isclass Info&lt;br /&gt;
 {&lt;br /&gt;
   string telephone;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;for&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*&#039;&#039;for&#039;&#039; is a control flow loop statement.&lt;br /&gt;
*A &#039;&#039;for&#039;&#039; loop has four parts and takes the form: &#039;&#039;for(A; B; C) D&#039;&#039; where:&lt;br /&gt;
**A initialises a counter variable, and is executed before the looping begins&lt;br /&gt;
**B is the test condition, looping will continue while B is true&lt;br /&gt;
**C is the loop expression, and will be executed at the end of every loop&lt;br /&gt;
**D is the code body statement, usually a compound statement, and is executed on every loop.&lt;br /&gt;
 Junction[] junctions = GetJunctionList();&lt;br /&gt;
 int i;&lt;br /&gt;
 for (i = 0; i &amp;lt; junctions.size(); ++i)&lt;br /&gt;
 {&lt;br /&gt;
   string name = junctions[i].GetLocalisedName();&lt;br /&gt;
   Interface.Print(&amp;quot;Junction &amp;quot; + i + &amp;quot; is named: &amp;quot; + name);&lt;br /&gt;
 }&lt;br /&gt;
*Depending on the values of Parts A and B the loop may not execute at all.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;game&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Class specifier reserved for built-in predefined classes.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;goto&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*The &#039;&#039;goto&#039;&#039; statement will branch to a label statement. For example:&lt;br /&gt;
 int i = 5;&lt;br /&gt;
 &lt;br /&gt;
 label_A:&lt;br /&gt;
 Interface.Print(&amp;quot;hello&amp;quot;);&lt;br /&gt;
 if (i--)&lt;br /&gt;
  goto label_A;&lt;br /&gt;
&lt;br /&gt;
*The above code will print hello 5 times. (zero evaluates as boolean false)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;if&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*&#039;&#039;if&#039;&#039; and &#039;&#039;else&#039;&#039; are keywords for the construction of &#039;&#039;if / then / else&#039;&#039; constructs used to control program flow&lt;br /&gt;
*Code following an &#039;&#039;if(condition)&#039;&#039; statement is executed only when the condition evaluates to true.&lt;br /&gt;
*In any other case execution branches to any immediately following &#039;&#039;else&#039;&#039; statement.&lt;br /&gt;
*&#039;&#039;else&#039;&#039; and &#039;&#039;else if&#039;&#039; clauses are optional.&lt;br /&gt;
 int i = Math.Rand(0, 3);&lt;br /&gt;
 &lt;br /&gt;
 if (i == 0)&lt;br /&gt;
 {&lt;br /&gt;
   Interface.Print(&amp;quot;i is 0&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else if (i == 1)&lt;br /&gt;
 {&lt;br /&gt;
   Interface.Print(&amp;quot;i is 1&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
   Interface.Print(&amp;quot;i is 2&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;include&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Syntax: &#039;&#039;include &amp;quot;filename.gs&amp;quot;&#039;&#039;&lt;br /&gt;
*This statement must appear before any class declarations and will include the contents of the specified script file.&lt;br /&gt;
*It is generally sufficient to include the *.gs filename related to the immediate parent of your script.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;inherited&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*an inherited() statement is made within a method definition to call the corresponding method in the immediate parent of the class.&lt;br /&gt;
*inherited() returns the same type, and takes the same parameters as the parent method.&lt;br /&gt;
*Inheritance is central to Object Oriented Programming, you should not omit these calls.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;legacy_compatibility&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*The legacy_compatibility keyword indicates that a specific function exists in order to support legacy usage only.&lt;br /&gt;
*A function with the legacy_compatibility keyword will not generate compiler warnings about obsolete function usages.&lt;br /&gt;
*legacy_compatibility functions are most commonly used to load and upgrade legacy data formats.&lt;br /&gt;
*Added at trainz-build 5.0&lt;br /&gt;
*See also: [[#obsolete|obsolete]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;mandatory&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*mandatory is a method specifier which indicates that, if the method is over-ridden the over-ridden method &#039;&#039;&#039;must&#039;&#039;&#039; call &#039;&#039;inherited&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;me&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*me refers to the current object, similar to &#039;&#039;self&#039;&#039; or &#039;&#039;this&#039;&#039; keywords in other languages.&lt;br /&gt;
*me is used to overcome ambiguity of variable scope, or use the current object as a function parameter.&lt;br /&gt;
*me is often understood if not stated, these statements would have the same effect:&lt;br /&gt;
 me.SetMeshAnimationState();&lt;br /&gt;
 SetMeshAnimationState()&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;native&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*A method specifier which indicates that the method is implemented by the games &amp;quot;native code&amp;quot; rather than in script code.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;null&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*null is an uninitialised expression.&lt;br /&gt;
*Every reference that is not assigned to an object has the value null.&lt;br /&gt;
*Assigning null to an existing object will remove that reference to that object. When no references remain, the object will be deleted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;obsolete&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Indicates that the function is obsolete and should not be used, except to support/load legacy saved data.&lt;br /&gt;
*Obsolete functions may not operate and/or may generate errors in certain [[Compatibility_mode|Compatibility mode settings]].&lt;br /&gt;
*Some functions are marked obsolete because their features are not supported, but many will have modern replacements.&lt;br /&gt;
*See also: [[#legacy_compatibility|legacy_compatibility]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;on&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*see [[#wait|wait]]()&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;public&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*A specifier indicating that the member or method is accessible by other classes.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;return&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Exits immediately from the current method, used when the method return type is void.&lt;br /&gt;
*or exit from the current method returning &#039;&#039;value&#039;&#039; to the calling routine.&lt;br /&gt;
*Value must match the method return type.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;static&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*&#039;&#039;static&#039;&#039; is a class specifier denoting that only one instance of the class may exist.&lt;br /&gt;
*Static classes cannot be created using the new operator.&lt;br /&gt;
*To access a static class refer to its members or methods using the class name as follows:&lt;br /&gt;
 static class Owner&lt;br /&gt;
 {&lt;br /&gt;
    public string forename;              // Public member variable&lt;br /&gt;
    public string surname;               // Public member variable&lt;br /&gt;
    &lt;br /&gt;
    // Public function&lt;br /&gt;
    public string GetName(void)&lt;br /&gt;
    {&lt;br /&gt;
      return forename + &amp;quot; &amp;quot; + surname;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 class Postbox isclass MapObject&lt;br /&gt;
 {&lt;br /&gt;
    public void Init(void)&lt;br /&gt;
    {&lt;br /&gt;
       if (!Owner.forename)&lt;br /&gt;
         Owner.forename = &amp;quot;Fred&amp;quot;;&lt;br /&gt;
       if (!Owner.surname)&lt;br /&gt;
         Owner.surname = &amp;quot;Bloggs&amp;quot;;&lt;br /&gt;
       Interface.Print(Owner.GetName());&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
*Since only one instance of owner may exist it will be created along with the first instance of the postbox obect&lt;br /&gt;
*Any future postboxes will find the members of the owner class already initialised and ready for use.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;switch&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*See &#039;&#039;[[#case|case]]&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;thread&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*A &#039;&#039;thread&#039;&#039; is a method which runs independently of the main script code.&lt;br /&gt;
*&#039;&#039;threads&#039;&#039; can be started and synchronised by standard methods or other threads but are allowed to wait for events or to carry out tasks requiring periods of inactivity without interrupting the main program flow.&lt;br /&gt;
*Threaded methods may only be declared in classes extending the GameObject class or its children.&lt;br /&gt;
*Many threads (up to 64) may be running on the same game object instance at a time.&lt;br /&gt;
 class Tutorial isclass Buildable&lt;br /&gt;
 {&lt;br /&gt;
   bool bThreadRunning = false;&lt;br /&gt;
   bool doorsOpen = false;&lt;br /&gt;
 &lt;br /&gt;
   public void Init(void)&lt;br /&gt;
   {&lt;br /&gt;
     inherited();&lt;br /&gt;
     AddHandler(me, &amp;quot;Object&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;ObjectHandler&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   thread void RingTheBell(void)&lt;br /&gt;
   {&lt;br /&gt;
      // Make sure we don&#039;t run multiple &#039;RingTheBell&#039; threads at once.&lt;br /&gt;
      if (bThreadRunning)&lt;br /&gt;
        return;&lt;br /&gt;
      bThreadRunning = true;&lt;br /&gt;
      &lt;br /&gt;
      while (doorsOpen)&lt;br /&gt;
      {&lt;br /&gt;
        // Play sound file&lt;br /&gt;
        World.Play2DSound(GetAsset(),&amp;quot;bell.wav&amp;quot;);&lt;br /&gt;
        &lt;br /&gt;
        // Wait for sound file to finish&lt;br /&gt;
        Sleep(0.35);&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      bThreadRunning = false;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   void ObjectHandler(Message msg)&lt;br /&gt;
   {&lt;br /&gt;
      if (msg.minor == &amp;quot;Enter&amp;quot;)&lt;br /&gt;
      {&lt;br /&gt;
         doorsOpen = true;&lt;br /&gt;
         RingTheBell();&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        doorsOpen = false;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
*In the above the &#039;&#039;thread RingTheBell&#039;&#039; is started on an &#039;&#039;Object,Enter&#039;&#039; message and will terminate on any other &#039;&#039;Object&#039;&#039; message.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;true&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*Boolean constant&lt;br /&gt;
 !false = true&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;void&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*&#039;&#039;void&#039;&#039; is a null type used in two situations:&lt;br /&gt;
*to indicate that a method requires no parameters&lt;br /&gt;
*to indicate that a method does not return a value&lt;br /&gt;
 public void DoTheDo(void) { }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;wait&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*&#039;&#039;wait&#039;&#039; is a control flow statement that suspends execution of a thread pending receipt of a message of a given type.&lt;br /&gt;
*It can listen for multiple message types using the on statement.&lt;br /&gt;
*When a wait statement is executed, execution stops on the thread until one of the on conditions is met.&lt;br /&gt;
 wait()&lt;br /&gt;
 {&lt;br /&gt;
    on &amp;quot;hello&amp;quot;, &amp;quot;world&amp;quot; :&lt;br /&gt;
    {&lt;br /&gt;
       // code here will execute for any &#039;&#039;hello,world&#039;&#039; message and then continue to wait for other messages.&lt;br /&gt;
       continue;&lt;br /&gt;
    }&lt;br /&gt;
    on &amp;quot;hi&amp;quot;, &amp;quot;there&amp;quot; :&lt;br /&gt;
    {&lt;br /&gt;
       // code here will execute for any &#039;&#039;hi,there&#039;&#039; message and then exit the loop.&lt;br /&gt;
       break;&lt;br /&gt;
    }&lt;br /&gt;
    on &amp;quot;hey&amp;quot;, &amp;quot;&amp;quot; :&lt;br /&gt;
    {&lt;br /&gt;
       // code here will execute for any message with a major type of&lt;br /&gt;
       // &amp;quot;hey&amp;quot; this will break by default, terminating the wait() loop.&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h4&amp;gt;while&amp;lt;/h4&amp;gt;}}&lt;br /&gt;
*A &#039;&#039;while(condition)&#039;&#039; is a loop control method that will continue as long as its condition evaluates to true.&lt;br /&gt;
*Note that if the condition is initially false the loop will not run at all&lt;br /&gt;
 int i = 5;&lt;br /&gt;
 while (i &amp;gt; 0)&lt;br /&gt;
 {&lt;br /&gt;
   Interface.Print(&amp;quot;i is greater than zero (&amp;quot; + i + &amp;quot;)&amp;quot;);&lt;br /&gt;
   --i;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Jonies</name></author>
	</entry>
</feed>