<?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=Danny252</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=Danny252"/>
	<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/wiki/Special:Contributions/Danny252"/>
	<updated>2026-11-05T06:25:02Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Message_Reference&amp;diff=26659</id>
		<title>TrainzScript Message Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Message_Reference&amp;diff=26659"/>
		<updated>2020-12-30T11:02:56Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* How to listen for Messages */ Add link to `wait` definition.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==What are Messages and how can they be used?==&lt;br /&gt;
&lt;br /&gt;
Messages: &lt;br /&gt;
* Are internal communications between objects within Trainz.&lt;br /&gt;
* Are completely hidden from the normal user, who won&#039;t be aware of their existence.&lt;br /&gt;
* Provide notification of events within the Trainz script environment.&lt;br /&gt;
* Provide a means of opening direct communications between objects.&lt;br /&gt;
* Provide a means of sending instructions from one script to another.&lt;br /&gt;
* Provide a means of timing scripted actions.&lt;br /&gt;
&lt;br /&gt;
Messages are managed by the &#039;&#039;Router&#039;&#039;, a sort of internal post office, and can be exchanged between any objects which descend from &#039;&#039;[[GameObject]]&#039;&#039;, this includes driver commands, rules and libraries as well as almost all mesh based scriptable objects.&lt;br /&gt;
&lt;br /&gt;
Scripts can:&lt;br /&gt;
* Listen for messages and use them to take appropriate actions in response to events and instructions. &lt;br /&gt;
* Use the message to extract information about the object sending or receiving the message.&lt;br /&gt;
* Define and issue their own messages.&lt;br /&gt;
* Listen in to messages intended for other objects.&lt;br /&gt;
* Send messages to themselves, to arrive after a specified delay, as a &#039;reminder&#039; to do something at a future time. &lt;br /&gt;
&lt;br /&gt;
Messages are small data objects containing five pieces of information:&lt;br /&gt;
* &#039;&#039;msg.major&#039;&#039;: A string identifying the message type.&lt;br /&gt;
* &#039;&#039;msg.minor&#039;&#039;: A string containing the message subtype or additional information. &lt;br /&gt;
* &#039;&#039;msg.src&#039;&#039;: A reference to the object that sent the message.&lt;br /&gt;
* &#039;&#039;msg.dst&#039;&#039;: The intended recipient. May be null if the message was &#039;&#039;broadcast&#039;&#039; (legacy behavior, no longer supported).&lt;br /&gt;
* &#039;&#039;msg.paramSoup&#039;&#039;: A Soup object containing extra data about the message (may be null).&lt;br /&gt;
&lt;br /&gt;
==How to listen for Messages==&lt;br /&gt;
&lt;br /&gt;
There are three techniques you can use:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[GameObject#AddHandler|AddHandler()]]&#039;&#039; This is the simplest listening device and is most useful when you know that you will always be interested in this type of message. &#039;&#039;[[GameObject#AddHandler|AddHandler()]]&#039;&#039; is usually set up in the &#039;&#039;Init()&#039;&#039; method of a script. Hint: omit any optional spaces in statements that include an AddHandler function, as including them causes the function to be ignored without notification in TRS2004 and perhaps other versions as well.&lt;br /&gt;
* A &#039;&#039;[[TrainzScript Keywords#wait|wait()]]&#039;&#039; loop. This needs to run in a separate thread and allows for a temporary arrangement where you want to know about messages for a shorter period or under a specified set of conditions.&lt;br /&gt;
* &#039;&#039;[[GameObject#Sniff|Sniff()]]&#039;&#039;.  This allows you to &#039;eavesdrop&#039; on messages being sent to another object.&lt;br /&gt;
&lt;br /&gt;
==When and how to send Messages==&lt;br /&gt;
&lt;br /&gt;
You might consider issuing messages of your own under the following circumstances:&lt;br /&gt;
&lt;br /&gt;
* When an event has taken place in your script and other objects might need to know about it.&lt;br /&gt;
* When you want to make your object available to other scripts to allow them to call your methods directly.&lt;br /&gt;
* When you need to issue instructions to another object to carry out a particular task and you know that the target object will be able to understand your message.&lt;br /&gt;
* When you want your own script to take an action at some time in the future, or at regular intervals.&lt;br /&gt;
&lt;br /&gt;
There are three routines you can use to issue messages:&lt;br /&gt;
&lt;br /&gt;
* [[GameObject#SendMessage|SendMessage()]] dispatches the message immediately.&lt;br /&gt;
* [[GameObject#PostMessage|PostMessage()]] dispatches the message via the Router with a specified delay (which can be zero). The message will be executed on the next Router update after the delay has elapsed.&lt;br /&gt;
* [[Class Router#PostMessage|Router.PostMessage()]] allows messages to be dispatched even if the object you are scripting doesn&#039;t have its own messaging capabilities.&lt;br /&gt;
&lt;br /&gt;
If the message destination is entered as &#039;&#039;me&#039;&#039; (meaning the current object) the message will be sent to the object which owns the script. If the destination is &#039;&#039;null&#039;&#039; the message will be &#039;&#039;broadcast&#039;&#039; and therefore available to any object in the session. Message broadcasting is obsolete as of TRS19 however, and may result in script exceptions or silent failures (depending on the local players compatibility setting).&lt;br /&gt;
&lt;br /&gt;
If you have a reference to the message target (or if you know its name or id) you should consider the following:&lt;br /&gt;
&lt;br /&gt;
* If you know which methods to use it might be more appropriate to call the other script directly.&lt;br /&gt;
* You should always avoid broadcasting messages if it is possible to send them directly to the intended recipient.&lt;br /&gt;
&lt;br /&gt;
==Never Assume Anything==&lt;br /&gt;
&lt;br /&gt;
The messaging system contains many traps for the unwary.  If you are working with a junction for instance you will receive an &#039;&#039;Object,Enter&#039;&#039; message whenever a train enters your object&#039;s trigger zone.  It is not safe however to assume that a subsequent &#039;&#039;Object,Leave&#039;&#039; means that the train has crossed the junction and left on the other side. Any of the following would also produce &#039;&#039;Object,Leave&#039;&#039;:&lt;br /&gt;
* The train might have stopped and reversed away from your object.&lt;br /&gt;
* An intervening junction might have been toggled so that the train is no longer visible to your object.&lt;br /&gt;
* The train might have coupled to another (and therefore ceased to exist) before reaching your object.&lt;br /&gt;
It is usually necessary to treat a message as an indication that the event you are interested in could have happened and to use other tests to confirm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
Listening for messages and using message handler methods&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=#808080&amp;gt;// script can be attached to any scenery object&lt;br /&gt;
 // enable the message window to view the output in Driver mode&amp;lt;/font&amp;gt;&lt;br /&gt;
 class Messenger isclass MapObject {&lt;br /&gt;
 &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       &amp;lt;font color=#808080&amp;gt;// listen for Junction and World,ModuleInit messages&amp;lt;/font&amp;gt;&lt;br /&gt;
       AddHandler(me,&amp;quot;Junction&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ToggleHandler&amp;quot;);&lt;br /&gt;
       AddHandler(me,&amp;quot;World&amp;quot;,&amp;quot;ModuleInit&amp;quot;,&amp;quot;ModuleInitHandler&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    thread void TriggerMonitor(void) {&lt;br /&gt;
       &amp;lt;font color=#808080&amp;gt;// Trigger messages will be passed to us as a result of the &lt;br /&gt;
       // Sniff() call in ModuleInitHandler&amp;lt;/font&amp;gt;&lt;br /&gt;
       Message msg;&lt;br /&gt;
       wait() {&lt;br /&gt;
          &amp;lt;font color=#808080&amp;gt;// listen for Trigger,Enter, print a message when heard, continue listening&amp;lt;/font&amp;gt;&lt;br /&gt;
          on &amp;quot;Trigger&amp;quot;,&amp;quot;Enter&amp;quot;,msg: {&lt;br /&gt;
             Interface.Print(&amp;quot;A train has entered a trigger&amp;quot;);&lt;br /&gt;
             continue;&lt;br /&gt;
          }&lt;br /&gt;
          &amp;lt;font color=#808080&amp;gt;// listen for Trigger,Stopped, print a message when heard and then quit the thread&amp;lt;/font&amp;gt;&lt;br /&gt;
          on &amp;quot;Trigger&amp;quot;,&amp;quot;Stopped&amp;quot;,msg: {&lt;br /&gt;
             Interface.Print(&amp;quot;A train has stopped on a trigger&amp;quot;);&lt;br /&gt;
             Interface.Print(&amp;quot;Trigger monitoring discontinued&amp;quot;);&lt;br /&gt;
             break;&lt;br /&gt;
          }&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    void ToggleHandler(Message msg) {&lt;br /&gt;
       &amp;lt;font color=#808080&amp;gt;// print a message whenever Junction,Toggled is broadcast&amp;lt;/font&amp;gt;&lt;br /&gt;
       Interface.Print(&amp;quot;A junction has been toggled&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    void ModuleInitHandler(Message msg) {&lt;br /&gt;
       if (World.GetCurrentModule() == World.DRIVER_MODULE) {&lt;br /&gt;
          &amp;lt;font color=#808080&amp;gt;// attach a handler to the first train on the map instructing it&lt;br /&gt;
          // to copy any Trigger messages to us&amp;lt;/font&amp;gt;&lt;br /&gt;
          Sniff(World.GetTrainList()[0],&amp;quot;Trigger&amp;quot;,&amp;quot;&amp;quot;,true);&lt;br /&gt;
          &amp;lt;font color=#808080&amp;gt;// start monitoring Trigger messages&amp;lt;/font&amp;gt;&lt;br /&gt;
          TriggerMonitor();&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [[List of Standard Messages]]&lt;br /&gt;
* [[Animation-Event Message]]&lt;br /&gt;
* [[Browser Messages]]&lt;br /&gt;
* [[Camera Messages]]&lt;br /&gt;
* [[Interface Messages]]&lt;br /&gt;
* [[MapObject Messages]]&lt;br /&gt;
* [[ModuleInit Message]]&lt;br /&gt;
* [[Object Messages]]&lt;br /&gt;
* [[pfx Message]]&lt;br /&gt;
* [[Signal Messages]]&lt;br /&gt;
* [[Train Messages]]&lt;br /&gt;
* [[Vehicle Messages]]&lt;br /&gt;
* [[GameObject]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_Asset&amp;diff=26657</id>
		<title>Class Asset</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_Asset&amp;diff=26657"/>
		<updated>2020-12-29T11:32:19Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add links between language reference pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**[[Class GSObject|GSObject]]&lt;br /&gt;
***Asset&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The term &#039;&#039;Asset&#039;&#039; refers to an individual item of content for Trainz.  All assets have a [[Class KUID|KUID]] which provides unique identification, a &#039;&#039;config.txt&#039;&#039; file which provides configuration data and an optional [[Class StringTable|StringTable]] which is a repository for indexed string values and a means of providing for foreign language translation.&lt;br /&gt;
&lt;br /&gt;
An asset provides the information that TRS needs to place a new &#039;&#039;object&#039;&#039;, also referred to as an &#039;&#039;instance&#039;&#039; of the asset, into the game environment.&lt;br /&gt;
&lt;br /&gt;
Some of the methods in this class refer to the asset&#039;s &#039;&#039;kuid-table&#039;&#039;, a container within &#039;&#039;config.txt&#039;&#039; which lists the kuids of other assets which are required for proper functioning. These assets are often listed using an integer index:&lt;br /&gt;
 kuid-table {&lt;br /&gt;
    0    &amp;lt;kuid:44179:60013&amp;gt;&lt;br /&gt;
    1    &amp;lt;kuid:-3:10110&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
The kuid-table is however in &#039;&#039;[[Class Soup|Soup]]&#039;&#039; format which allows descriptive labels to be used instead. This makes it easier for a script to refer to the [[Class KUID|KUID]] or the asset concerned:&lt;br /&gt;
 kuid-table {&lt;br /&gt;
    coal           &amp;lt;kuid:44179:60013&amp;gt;&lt;br /&gt;
    greencorona    &amp;lt;kuid:-3:10110&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==FindAsset==&lt;br /&gt;
{{MethodHeader|public native Asset FindAsset(string kuidTableAssetName)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuidTableAssetName&#039;&#039;&#039; = Tag value referencing a dependency as entered in the &#039;&#039;kuid-table&#039;&#039; from the asset&#039;s &#039;&#039;config.txt&#039;&#039;.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the asset represented by the &#039;&#039;kuid-table&#039;&#039; entry.&lt;br /&gt;
;Syntax&lt;br /&gt;
 &amp;lt;font color=#808080&amp;gt;// kuid-table of this asset&lt;br /&gt;
 kuid-table {&lt;br /&gt;
    green  &amp;lt;kuid:-3:10110&amp;gt;&lt;br /&gt;
 }&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Asset asset = GetAsset().FindAsset(&amp;quot;green&amp;quot;);  // returns a reference to the built-in green corona&lt;br /&gt;
;Notes&lt;br /&gt;
*Returns null if the kuid-table entry is invalid or if it does not exist.&lt;br /&gt;
*This method is the equivalent of &#039;&#039;[[Class World#FindAsset|World.FindAsset]]([[Class TrainzGameObject#GetAsset|GetAsset()]].[[#LookupKUIDTable|LookupKUIDTable]](kuidTableName))&#039;&#039;&lt;br /&gt;
;See Also&lt;br /&gt;
*[[#LookupKUIDTable|LookupKUIDTable()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetConfigSoup==&lt;br /&gt;
{{MethodHeader|public native [[Class Soup|Soup]] GetConfigSoup(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The contents of the &#039;&#039;config.txt&#039;&#039; file belonging to the scripted asset in [[Soup]] format.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Soup soup = [[Class TrainzGameObject#GetAsset|GetAsset()]].GetConfigSoup();&lt;br /&gt;
;Notes&lt;br /&gt;
*The Soup returned by this method will be read only.&lt;br /&gt;
*Sub containers within &#039;&#039;config.txt&#039;&#039; can be accessed as sub soups:&lt;br /&gt;
 Soup meshTable = [[Class TrainzGameObject#GetAsset|GetAsset()]].GetConfigSoup().[[Class Soup#GetNamedSoup|GetNamedSoup]](&amp;quot;mesh-table&amp;quot;);&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetKUID==&lt;br /&gt;
{{MethodHeader|public native [[Class KUID|KUID]] GetKUID(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*[[Class KUID|KUID]] of current asset&lt;br /&gt;
;Syntax&lt;br /&gt;
 KUID kuid = GetAsset().GetKUID();&lt;br /&gt;
;Notes&lt;br /&gt;
*Return format is &amp;lt;kuid:1234:5678&amp;gt; or &amp;lt;kuid2:1234:5678:9&amp;gt; as appropriate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLocalisedName==&lt;br /&gt;
{{MethodHeader|public native string GetLocalisedName(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*String representing the localised username of the asset.&lt;br /&gt;
*For English versions of the game this will be the contents of the &#039;&#039;config.txt&#039;&#039; tag &#039;&#039;username&#039;&#039;&lt;br /&gt;
;Syntax&lt;br /&gt;
 string username = [[Class TrainzGameObject#GetAsset|GetAsset()]].GetLocalisedName();&lt;br /&gt;
;Notes&lt;br /&gt;
*For other language versions the result will be the equivalent localised username, if it exists.&lt;br /&gt;
*For German, &#039;&#039;username-de&#039;&#039;&lt;br /&gt;
*For Italian, &#039;&#039;username-it&#039;&#039;&lt;br /&gt;
*If there is no localised tag, then the contents of &#039;&#039;username&#039;&#039; will be returned.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStringTable==&lt;br /&gt;
{{MethodHeader|public native [[Class StringTable|StringTable]] GetStringTable(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the asset&#039;s [[Class StringTable|StringTable]].&lt;br /&gt;
;Syntax&lt;br /&gt;
 StringTable strings = GetAsset().GetStringTable();&lt;br /&gt;
;Notes&lt;br /&gt;
*Any asset can have a &#039;&#039;[[Class StringTable|StringTable]]&#039;&#039; in its configuration that consists of a collection of named string elements in &#039;&#039;Soup&#039;&#039; format. &lt;br /&gt;
*Foreign language versions will return a localised StringTable, using the &#039;&#039;config.txt&#039;&#039; container &#039;&#039;string-table-es&#039;&#039; for instance. This provides for translation of the user interface of an asset.&lt;br /&gt;
*The returned &#039;&#039;[[Class StringTable|StringTable]]&#039;&#039; object provides methods to easily access these strings. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LookupKUIDTable==&lt;br /&gt;
{{MethodHeader|public native [[Class KUID|KUID]] LookupKUIDTable(string kuidTableAssetName)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuidTableAssetName&#039;&#039;&#039; = Name referencing a dependency KUID as entered in the &#039;&#039;kuid-table&#039;&#039; from the asset&#039;s &#039;&#039;config.txt&#039;&#039;.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the [[KUID]] represented by the &#039;&#039;kuid-table&#039;&#039; entry.&lt;br /&gt;
;Syntax&lt;br /&gt;
 &amp;lt;font color=#808080&amp;gt;// kuid-table of this asset&lt;br /&gt;
 kuid-table {&lt;br /&gt;
    green  &amp;lt;kuid:-3:10110&amp;gt;&lt;br /&gt;
 }&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 KUID kuid = [[Class TrainzGameObject#GetAsset|GetAsset()]].LookupKUIDTable(&amp;quot;green&amp;quot;);  // returns a reference to the built-in green corona&lt;br /&gt;
;Notes&lt;br /&gt;
*Returns null if the kuid-table entry is invalid or if it does not exist.&lt;br /&gt;
;See Also&lt;br /&gt;
*[[#FindAsset|FindAsset()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Examples==&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
[[Class World#Find Asset|World.FindAsset()]]&lt;br /&gt;
&lt;br /&gt;
[[Class TrainzGameObject#GetAsset|TrainzGameObject.GetAsset()]]&lt;br /&gt;
&lt;br /&gt;
[[Class World#GetAssetList|World.GetAssetList()]]&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=HowTo/Search_for_objects_in_the_world&amp;diff=26616</id>
		<title>HowTo/Search for objects in the world</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=HowTo/Search_for_objects_in_the_world&amp;diff=26616"/>
		<updated>2020-12-28T20:06:26Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Named Object Searches */ Correct example to wait for AsyncResult, not AsyncLoadComplete&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Scripted asset may sometimes wish to search for other objects within the world, either in bulk lists, or for a specific single object. This page is intended to provide an overview of how this is achieved in the latest versions of Trainz. Details about certain legacy search methods and the best modern techniques to update them to are also provided in the final section of this page.&lt;br /&gt;
&lt;br /&gt;
==Object Identification==&lt;br /&gt;
Scripted objects identified in script using several different methods, many of which have become obsolete as Trainz and the script environment has grown in complexity. As of trainz-build 4.5 (TANE SP2 and later) scripted objects should be identified using their GameObjectID, where present. This ID format has been designed to be future-proof/extensible, should the need arise, and supports various lookup and generic storage functions as per the legacy integer and string based IDs. For more information about legacy ID formats, see [[HowTo/Search_for_objects_in_the_world#Legacy_Search_Functions|here]].&lt;br /&gt;
&lt;br /&gt;
The GameObjectID class is defined within GameObjectID.gs, which can be found in the Trainz core script folder (resources/scripts). For the most up to date and accurate usage instructions please see the comments within that file.&lt;br /&gt;
&lt;br /&gt;
==Named Object Searches==&lt;br /&gt;
It is occasionally desirable for scripted assets to be able to search for objects within the world. Most commonly, this is a requirement of session rules, which frequently require a session creator to specify target trains, junctions, signals, etc, in order to perform some gameplay function. Occasionally, placable assets such as industries etc may also require this feature. One such example is the Interlocking Tower asset type, which performs complex management of track blocks using management of user defined signals, junctions and crossings.&lt;br /&gt;
&lt;br /&gt;
As of trainz-build 4.5 (TANE SP2 and later) manual object searches are performed via the World.GetNamedObjectList() function. This function takes both a [[Category_List|category list]] and a partial name, allowing for very specific searches, or quite broad ones. Once called, this function returns an object of type AsyncObjectSearchResult, which is used to monitor for the search completion, and then to retrieve the results. For the most up to date and accurate information on how to use GetNamedObjectList and AsyncObjectSearchResult, please see their script comments. Both are currently defined in World.gs, which can be found in the Trainz core script folder (resources/scripts).&lt;br /&gt;
&lt;br /&gt;
Usage example:&lt;br /&gt;
&lt;br /&gt;
 thread void SearchForTrains()&lt;br /&gt;
 {&lt;br /&gt;
   // Start a search for any traincars within the world&lt;br /&gt;
   AsyncObjectSearchResult searchObj = World.GetNamedObjectList(AssetCategory.TrainCar, &amp;quot;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   // Sniff for search related messages, and then wait for either completion or failure&lt;br /&gt;
   Sniff(searchObj, &amp;quot;ObjectSearch&amp;quot;, &amp;quot;&amp;quot;, true);&lt;br /&gt;
   Message msg;&lt;br /&gt;
   wait()&lt;br /&gt;
   {&lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
     &lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;AsyncResult&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
   };&lt;br /&gt;
   &lt;br /&gt;
   // Check the results&lt;br /&gt;
   int errCode = searchObj.GetSearchErrorCode();&lt;br /&gt;
   if (errCode != AsyncObjectSearchResult.ERROR_NONE)&lt;br /&gt;
   {&lt;br /&gt;
     // TODO: Add any error handling here, such as waiting and reattempting the&lt;br /&gt;
     // search later, showing an error message, throwing script exceptions, etc.&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // Get the search results&lt;br /&gt;
   NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any processing of the results here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Storing References to Specific Objects==&lt;br /&gt;
As shown in the example above, named object searches return their results as an array of NamedObjectInfo objects. Currently, this class has 4 member variables:&lt;br /&gt;
* objectRef - A reference to the object, if it is currently loaded&lt;br /&gt;
* objectId - The GameObjectID for the object (see GameObjectID.gs)&lt;br /&gt;
* localisedUsername - The localised name of the object, for displaying to the player&lt;br /&gt;
* categoryString - A category string, usable to further determine the exact type and features of the object&lt;br /&gt;
&lt;br /&gt;
Any script which wishes to save a reference to specific named object should /always/ do so via the GameObjectID. This is currently the /only/ safe and reliable way to store and later retrieve a specific object. If the object is currently loaded it is of course also safe to access and store a reference to the object itself, but note that Trainz may choose to unload the object at any time (if it is inactive, and sufficiently far enough away from the player, etc). Attempts to use an object which native code has unloaded may result in native call errors. To avoid this scripts should call Router.DoesGameObjectStillExist() before attempting to use any object reference that has been stored for some time.&lt;br /&gt;
&lt;br /&gt;
Unlike the named object itself, a referenced GameObjectID will never be deleted by native code, and may be held by a script indefinitely. It can also be stored directly into a [[Soup]] database for storage and retrieval between runs of the game, over a network, etc. For details about saving a GameObjectID into a Soup database please see the comments in Soup.gs, located in the core Trainz script folder (resources/scripts).&lt;br /&gt;
&lt;br /&gt;
In addition to Soup storage, a GameObjectID can be serialised to a string for *temporary* storage. This allows scripts to do thing like store the ID directly in a trainzhttp link, etc (provided it is also appropriately escaped). However, it is crucial to note that the format of this string is *not* guaranteed and may change between versions of the game. As such, no attempt should be made to machine parse it, save it between runs or send it over a network. To convert the string back into a GameObjectID, use Router.SerialiseGameObjectIDFromString().&lt;br /&gt;
&lt;br /&gt;
It is also safe to cache and store the localised display name for an object, but it is important to remember that objects can be renamed, and that this object name may become out of date at any time. As such, scripts which store it should remember to update their cache whenever an opportunity arises (e.g. during any validation steps).&lt;br /&gt;
&lt;br /&gt;
==Searching for Specific Objects by ID==&lt;br /&gt;
Several functions exist for looking up an object which has been saved via it&#039;s GameObjectID. Each of these serves a slightly different use-case, so it&#039;s important to understand them all before selecting the one that best suits the needs of a specific script.&lt;br /&gt;
&lt;br /&gt;
Two functions exist to retrieve a loaded object via it&#039;s ID. These both behave identically, and will return a reference to a matching object *only* if that object exists and is currently loaded. In all other cases the functions will return null. There is no way to determine the cause of a null result using this function.&lt;br /&gt;
&lt;br /&gt;
 GameObject objectRef1 = World.GetGameObjectByIDIfLoaded(mySavedID);&lt;br /&gt;
 &lt;br /&gt;
 GameObject objectRef2 = Router.GetGameObject(mySavedID);&lt;br /&gt;
&lt;br /&gt;
Another function exists to allow scripts to search for objects which are not currently loaded, and to optionally request that they are loaded. Scripts should only request loading of objects when absolutely necessary, and scripts which abuse this feature may have their requests ignored by native code in order to maintain performance. As this function may take a considerable amount of time to run, it uses an AsyncObjectSearchResult, much like the named object list functions described above.&lt;br /&gt;
&lt;br /&gt;
 AsyncObjectSearchResult searchObj = World.GetGameObjectByID(mySavedID, false);&lt;br /&gt;
&lt;br /&gt;
As with GetNamedObjectList(), calling scripts must Sniff the returned search object and wait for the appropriate result message(s) to be posted. To avoid the need for frequent code duplication another function also exists which allows threaded objects to perform this functionality in a pseudo-synchronous way.&lt;br /&gt;
&lt;br /&gt;
 GameObject loadedObjectRef = World.SynchronouslyLoadGameObjectByID(mySavedID);&lt;br /&gt;
&lt;br /&gt;
This function will throw exceptions if used incorrectly (e.g. if called outside of a thread function) so be sure to read and understand the comments on the function itself, before attempting to use it.&lt;br /&gt;
&lt;br /&gt;
==Script Library Lookups==&lt;br /&gt;
Script [[KIND_Library|library assets]] are unique within script in that they exist without any visual presence to the end player, and are shared across all scripts that access them. i.e. It is not possible to instantiate multiple instances of the same library asset within a single script context. This makes them extremely useful for managing, organising or communicating between other scripted asset types. For more information about library assets, see the [[KIND_Library]] page.&lt;br /&gt;
&lt;br /&gt;
As libraries are added to the world by script, and the not the player or session creator, they require a script accessible function to create and load them. This function is TrainzScriptBase.GetLibrary(). When this function is called the library asset will be immediately loaded and returned by Trainz native code. Once loaded, the library will remain loaded in script, and any future calls to GetLibrary() will return the same instance.&lt;br /&gt;
&lt;br /&gt;
Example usage:&lt;br /&gt;
 public void Init(Asset asset)&lt;br /&gt;
 {&lt;br /&gt;
   inherited(asset);&lt;br /&gt;
   &lt;br /&gt;
   // Load our shared library asset&lt;br /&gt;
   KUID libraryKuid = asset.LookupKUIDTable(&amp;quot;shared-library&amp;quot;);&lt;br /&gt;
   m_sharedLibrary = World.GetLibrary(libraryKuid);&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any library specific init, registration, etc code here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Legacy Search Functions==&lt;br /&gt;
Prior to trainz-build 4.5 (TANE SP1 and earlier) all world objects were loaded on Route/Session load, and remained that way until the session was ended. As Routes grow larger and larger this technique becomes unmanageable, and it is thus necessary for Trainz (and it&#039;s scripted assets) to support the unloading of objects which are not currently gameplay relevant. As a result of this, numerous script functions have been declared obsolete, as they are incompatible with this concept. Below is a summary of these functions and a mention of their modern replacements.&lt;br /&gt;
&lt;br /&gt;
=====GameObject.GetId()=====&lt;br /&gt;
All GameObject instances with a Router are assigned a numeric integer ID. This ID was traditionally retrieved via this function. As the ID varies between runs it was never safe for long term storage, but it was suitable for short term storage and lookup. As objects can now be unloaded at any time, and these IDs then reused by totally different objects, the function has been declared obsolete. Any scripts which use it should be updated to instead use GameObjectID and the related storage functions. See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====GameObject.GetName()=====&lt;br /&gt;
In addition to their integer ID certain GameObject types also supported a &amp;quot;script name&amp;quot;, which was generally automatically assigned on creation, but could also be edited by the player in some scenarios. Despite the script comments in certain older versions of Trainz, this name was never /guaranteed/ unique, but it was generally considered to be so for ease of use (and that assumption rarely failed). This script name was typically used for object identification in medium to long term storage, including within Soups for session config, savegames, etc. Any scripts which use it should be updated to instead use GameObjectID and the related storage functions. See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====Router.GetGameObject(int)=====&lt;br /&gt;
Much like GetGameObject(GameObjectID), this function would return any loaded object with the integer Router ID passed. As this ID format is now considered obsolete, so is this lookup function. Any scripts which use it should be updated to instead use GameObjectID and that function variant (or the async search functions on World). See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====Router.GetGameObject(string)=====&lt;br /&gt;
Much like GetGameObject(GameObjectID), this function would return any loaded object with the &amp;quot;script name&amp;quot; string passed. As this ID format is now considered obsolete, so is this lookup function. Any scripts which use it should be updated to instead use GameObjectID and that function variant (or the async search functions on World). See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====World.Get*List()=====&lt;br /&gt;
Prior to GetNamedObjectList() multiple functions existed on World to manually retrieve lists of objects of a specific type(e.g. GetIndustryList(), GetTrainList(), etc). These search functions were slow, and scripts would often stall Trainz while the searches were performed. Because of this, and the fact that the functions can now only return those objects that currently loaded, they have been declared obsolete. Any scripts which use them for custom functionality should be updated to instead use World.GetNamedObjectList(). See the comments on this function and the AsyncObjectSearchResult in World.gs for more information on their use. Alternatively, any scripts using them for PropertyObject &amp;quot;list&amp;quot; types may be better served by the new &amp;quot;map-object&amp;quot; type, detailed [[PropertyObject#GetPropertyType|here]].&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[Asynchronous_Route_Streaming| Asynchronous Route Streaming]]&lt;br /&gt;
&lt;br /&gt;
[[Category:How-to_guides|HowTo Guides]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26615</id>
		<title>Class AsyncObjectSearchResult</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26615"/>
		<updated>2020-12-28T20:05:57Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Code Examples */ Correct example to wait for AsyncResult, not AsyncLoadComplete&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;
****[[Class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
*****[[Class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*An AsyncObjectSearchResult represents an asynchronous search of objects in the game world.&lt;br /&gt;
*[[HowTo/Search for objects in the world]] provides a detailed tutorial on asynchronous searches.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*Messages sent to and from TrackMark 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;||bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncResult||AsyncObjectSearchResult||Broadcast||Search is complete, and [[#GetResults|GetResults]] may be called.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncLoadComplete||AsyncObjectSearchResult||Broadcast||Loading of search result has been completed. See [[Class World#GetGameObjectByID|World.GetGameObjectByID()]].&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Failure||AsyncObjectSearchResult||Broadcast||Search has failed, call [[#GetSearchErrorCode|GetSearchErrorCode]] for more information.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Expired||AsyncObjectSearchResult||Broadcast||New search results are available, and this result has expired. Not posted by default - see [[Class World#GetNamedObjectList|World.GetNamedObjectList()]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===GetResults===&lt;br /&gt;
{{MethodHeader|public native [[Class NamedObjectInfo|NamedObjectInfo]][] GetResults(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Array of search results&lt;br /&gt;
;Syntax&lt;br /&gt;
 NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
 for (int i = 0; i &amp;lt; results.size(); ++i) {&lt;br /&gt;
     NamedObjectInfo result = results[i];&lt;br /&gt;
     Interface.Log(&amp;quot;Result &amp;quot; + i + &amp;quot;: &#039;&amp;quot; + result.localisedUsername + &amp;quot;&#039;&amp;quot;);&lt;br /&gt;
     // Process each result in some useful way...&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*The caller must wait for the search to complete, indicated by the ObjectSearch/AsyncResult message.&lt;br /&gt;
*If the search is not complete, calling this method will result in an exception.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetQueryErrorCode===&lt;br /&gt;
{{MethodHeader|public native int GetQueryErrorCode(void)}}&lt;br /&gt;
See [[#GetSearchErrorCode|GetSearchErrorCode]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetSearchErrorCode===&lt;br /&gt;
{{MethodHeader|public native int GetSearchErrorCode(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Error code for the query&lt;br /&gt;
;Syntax&lt;br /&gt;
 wait() {&lt;br /&gt;
   on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
     if (msg.src == searchObj) {&lt;br /&gt;
       Interface.Log(&amp;quot;Search error &amp;quot; + searchObj.GetSearchErrorCode();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*When a ObjectSearch/Failure message is posted, this method will return an error code.&lt;br /&gt;
*Error codes are defined in the ERROR_ constants for [[Class AsyncQueryHelper|AsyncQueryHelper]].&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;
 thread void SearchForTrains()&lt;br /&gt;
 {&lt;br /&gt;
   // Start a search for any traincars within the world&lt;br /&gt;
   AsyncObjectSearchResult searchObj = World.GetNamedObjectList(AssetCategory.TrainCar, &amp;quot;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   // Sniff for search related messages, and then wait for either completion or failure&lt;br /&gt;
   Sniff(searchObj, &amp;quot;ObjectSearch&amp;quot;, &amp;quot;&amp;quot;, true);&lt;br /&gt;
   Message msg;&lt;br /&gt;
   wait()&lt;br /&gt;
   {&lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
     &lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;AsyncResult&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
   };&lt;br /&gt;
   &lt;br /&gt;
   // Check the results&lt;br /&gt;
   int errCode = searchObj.GetSearchErrorCode();&lt;br /&gt;
   if (errCode != AsyncObjectSearchResult.ERROR_NONE)&lt;br /&gt;
   {&lt;br /&gt;
     // TODO: Add any error handling here, such as waiting and reattempting the&lt;br /&gt;
     // search later, showing an error message, throwing script exceptions, etc.&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // Get the search results&lt;br /&gt;
   NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any processing of the results here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
*[[Class World#GetGameObjectByID|World.GetGameObjectByID()]]&lt;br /&gt;
*[[Class World#GetNamedObjectList|World.GetNamedObjectList()]]&lt;br /&gt;
&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26614</id>
		<title>Class AsyncObjectSearchResult</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26614"/>
		<updated>2020-12-28T19:43:40Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Related Messages */ Fix table formatting&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;
****[[Class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
*****[[Class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*An AsyncObjectSearchResult represents an asynchronous search of objects in the game world.&lt;br /&gt;
*[[HowTo/Search for objects in the world]] provides a detailed tutorial on asynchronous searches.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*Messages sent to and from TrackMark 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;||bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncResult||AsyncObjectSearchResult||Broadcast||Search is complete, and [[#GetResults|GetResults]] may be called.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncLoadComplete||AsyncObjectSearchResult||Broadcast||Loading of search result has been completed. See [[Class World#GetGameObjectByID|World.GetGameObjectByID()]].&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Failure||AsyncObjectSearchResult||Broadcast||Search has failed, call [[#GetSearchErrorCode|GetSearchErrorCode]] for more information.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Expired||AsyncObjectSearchResult||Broadcast||New search results are available, and this result has expired. Not posted by default - see [[Class World#GetNamedObjectList|World.GetNamedObjectList()]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===GetResults===&lt;br /&gt;
{{MethodHeader|public native [[Class NamedObjectInfo|NamedObjectInfo]][] GetResults(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Array of search results&lt;br /&gt;
;Syntax&lt;br /&gt;
 NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
 for (int i = 0; i &amp;lt; results.size(); ++i) {&lt;br /&gt;
     NamedObjectInfo result = results[i];&lt;br /&gt;
     Interface.Log(&amp;quot;Result &amp;quot; + i + &amp;quot;: &#039;&amp;quot; + result.localisedUsername + &amp;quot;&#039;&amp;quot;);&lt;br /&gt;
     // Process each result in some useful way...&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*The caller must wait for the search to complete, indicated by the ObjectSearch/AsyncResult message.&lt;br /&gt;
*If the search is not complete, calling this method will result in an exception.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetQueryErrorCode===&lt;br /&gt;
{{MethodHeader|public native int GetQueryErrorCode(void)}}&lt;br /&gt;
See [[#GetSearchErrorCode|GetSearchErrorCode]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetSearchErrorCode===&lt;br /&gt;
{{MethodHeader|public native int GetSearchErrorCode(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Error code for the query&lt;br /&gt;
;Syntax&lt;br /&gt;
 wait() {&lt;br /&gt;
   on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
     if (msg.src == searchObj) {&lt;br /&gt;
       Interface.Log(&amp;quot;Search error &amp;quot; + searchObj.GetSearchErrorCode();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*When a ObjectSearch/Failure message is posted, this method will return an error code.&lt;br /&gt;
*Error codes are defined in the ERROR_ constants for [[Class AsyncQueryHelper|AsyncQueryHelper]].&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;
 thread void SearchForTrains()&lt;br /&gt;
 {&lt;br /&gt;
   // Start a search for any traincars within the world&lt;br /&gt;
   AsyncObjectSearchResult searchObj = World.GetNamedObjectList(AssetCategory.TrainCar, &amp;quot;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   // Sniff for search related messages, and then wait for either completion or failure&lt;br /&gt;
   Sniff(searchObj, &amp;quot;ObjectSearch&amp;quot;, &amp;quot;&amp;quot;, true);&lt;br /&gt;
   Message msg;&lt;br /&gt;
   wait()&lt;br /&gt;
   {&lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
     &lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;AsyncLoadComplete&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
   };&lt;br /&gt;
   &lt;br /&gt;
   // Check the results&lt;br /&gt;
   int errCode = searchObj.GetSearchErrorCode();&lt;br /&gt;
   if (errCode != AsyncObjectSearchResult.ERROR_NONE)&lt;br /&gt;
   {&lt;br /&gt;
     // TODO: Add any error handling here, such as waiting and reattempting the&lt;br /&gt;
     // search later, showing an error message, throwing script exceptions, etc.&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // Get the search results&lt;br /&gt;
   NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any processing of the results here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
*[[Class World#GetGameObjectByID|World.GetGameObjectByID()]]&lt;br /&gt;
*[[Class World#GetNamedObjectList|World.GetNamedObjectList()]]&lt;br /&gt;
&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_AsyncQueryHelper&amp;diff=26613</id>
		<title>Class AsyncQueryHelper</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_AsyncQueryHelper&amp;diff=26613"/>
		<updated>2020-12-28T19:43:37Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Related Messages */ Fix table formatting&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;
****[[Class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
AsyncQueryHelper is a generic base class for asynchronous (non-blocking) queries. Most notably, it is inherited by the [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] class.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;AsyncQueryHelper.&#039;&#039;, for example:&lt;br /&gt;
 int errorCode = AsyncQueryHelper.ERROR_INVALID_STATE&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Search Errors and Warnings===&lt;br /&gt;
----&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int ERROR_NONE = 0 || Query completed without error&lt;br /&gt;
|-&lt;br /&gt;
|public define int ERROR_FLOOD = 1 || System is flooded, query was not run&lt;br /&gt;
|-&lt;br /&gt;
|public define int ERROR_INVALID_STATE = 2 || Invalid state for query. This is the initial state of an AsyncQueryHelper object.&lt;br /&gt;
|-&lt;br /&gt;
|public define int ERROR_NOT_COMPLETE = 3 || Query is still running&lt;br /&gt;
|-&lt;br /&gt;
|public define int WARN_MORE_RESULTS = 101 || Query aborted early because result limit was hit&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Error and Warning Number Ranges===&lt;br /&gt;
----&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WARNINGS_START = 100 || Error codes above 100 are warnings. Code 100 is not a valid result.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CUSTOM_ERROR_START = 1000 || Extending classes may define custom error codes between 1000 and 2000&lt;br /&gt;
|-&lt;br /&gt;
|public define int CUSTOM_WARN_START = 2000 || Extending classes may define custom warning codes above 2000&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*The major parameter of messages may be customised by the inheriting class, via the GetMessageMajor() function, however this should be avoided unless it is absolutely necessary.&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;||bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|AsyncQuery||AsyncResult||AsyncObjectSearchResult||Broadcast||Query is complete.&lt;br /&gt;
|-&lt;br /&gt;
|AsyncQuery||Failure||AsyncObjectSearchResult||Broadcast||Query has failed, call [[#GetQueryErrorCode|GetQueryErrorCode]] for more information.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Classes==&lt;br /&gt;
*[[Class World|AsyncObjectSearchResult]]&lt;br /&gt;
&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_AsyncQueryHelper&amp;diff=26612</id>
		<title>Class AsyncQueryHelper</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_AsyncQueryHelper&amp;diff=26612"/>
		<updated>2020-12-28T19:42:51Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add partial docs on AsyncQueryHelper&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;
****[[Class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
AsyncQueryHelper is a generic base class for asynchronous (non-blocking) queries. Most notably, it is inherited by the [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] class.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;AsyncQueryHelper.&#039;&#039;, for example:&lt;br /&gt;
 int errorCode = AsyncQueryHelper.ERROR_INVALID_STATE&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Search Errors and Warnings===&lt;br /&gt;
----&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int ERROR_NONE = 0 || Query completed without error&lt;br /&gt;
|-&lt;br /&gt;
|public define int ERROR_FLOOD = 1 || System is flooded, query was not run&lt;br /&gt;
|-&lt;br /&gt;
|public define int ERROR_INVALID_STATE = 2 || Invalid state for query. This is the initial state of an AsyncQueryHelper object.&lt;br /&gt;
|-&lt;br /&gt;
|public define int ERROR_NOT_COMPLETE = 3 || Query is still running&lt;br /&gt;
|-&lt;br /&gt;
|public define int WARN_MORE_RESULTS = 101 || Query aborted early because result limit was hit&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Error and Warning Number Ranges===&lt;br /&gt;
----&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WARNINGS_START = 100 || Error codes above 100 are warnings. Code 100 is not a valid result.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CUSTOM_ERROR_START = 1000 || Extending classes may define custom error codes between 1000 and 2000&lt;br /&gt;
|-&lt;br /&gt;
|public define int CUSTOM_WARN_START = 2000 || Extending classes may define custom warning codes above 2000&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*The major parameter of messages may be customised by the inheriting class, via the GetMessageMajor() function, however this should be avoided unless it is absolutely necessary.&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;|bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|AsyncQuery||AsyncResult||AsyncObjectSearchResult||Broadcast||Query is complete.&lt;br /&gt;
|-&lt;br /&gt;
|AsyncQuery||Failure||AsyncObjectSearchResult||Broadcast||Query has failed, call [[#GetQueryErrorCode|GetQueryErrorCode]] for more information.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Classes==&lt;br /&gt;
*[[Class World|AsyncObjectSearchResult]]&lt;br /&gt;
&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26611</id>
		<title>Class AsyncObjectSearchResult</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26611"/>
		<updated>2020-12-28T19:42:42Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add GetQueryErrorCode&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;
****[[Class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
*****[[Class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*An AsyncObjectSearchResult represents an asynchronous search of objects in the game world.&lt;br /&gt;
*[[HowTo/Search for objects in the world]] provides a detailed tutorial on asynchronous searches.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*Messages sent to and from TrackMark 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;|bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncResult||AsyncObjectSearchResult||Broadcast||Search is complete, and [[#GetResults|GetResults]] may be called.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncLoadComplete||AsyncObjectSearchResult||Broadcast||Loading of search result has been completed. See [[Class World#GetGameObjectByID|World.GetGameObjectByID()]].&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Failure||AsyncObjectSearchResult||Broadcast||Search has failed, call [[#GetSearchErrorCode|GetSearchErrorCode]] for more information.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Expired||AsyncObjectSearchResult||Broadcast||New search results are available, and this result has expired. Not posted by default - see [[Class World#GetNamedObjectList|World.GetNamedObjectList()]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===GetResults===&lt;br /&gt;
{{MethodHeader|public native [[Class NamedObjectInfo|NamedObjectInfo]][] GetResults(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Array of search results&lt;br /&gt;
;Syntax&lt;br /&gt;
 NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
 for (int i = 0; i &amp;lt; results.size(); ++i) {&lt;br /&gt;
     NamedObjectInfo result = results[i];&lt;br /&gt;
     Interface.Log(&amp;quot;Result &amp;quot; + i + &amp;quot;: &#039;&amp;quot; + result.localisedUsername + &amp;quot;&#039;&amp;quot;);&lt;br /&gt;
     // Process each result in some useful way...&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*The caller must wait for the search to complete, indicated by the ObjectSearch/AsyncResult message.&lt;br /&gt;
*If the search is not complete, calling this method will result in an exception.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetQueryErrorCode===&lt;br /&gt;
{{MethodHeader|public native int GetQueryErrorCode(void)}}&lt;br /&gt;
See [[#GetSearchErrorCode|GetSearchErrorCode]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetSearchErrorCode===&lt;br /&gt;
{{MethodHeader|public native int GetSearchErrorCode(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Error code for the query&lt;br /&gt;
;Syntax&lt;br /&gt;
 wait() {&lt;br /&gt;
   on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
     if (msg.src == searchObj) {&lt;br /&gt;
       Interface.Log(&amp;quot;Search error &amp;quot; + searchObj.GetSearchErrorCode();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*When a ObjectSearch/Failure message is posted, this method will return an error code.&lt;br /&gt;
*Error codes are defined in the ERROR_ constants for [[Class AsyncQueryHelper|AsyncQueryHelper]].&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;
 thread void SearchForTrains()&lt;br /&gt;
 {&lt;br /&gt;
   // Start a search for any traincars within the world&lt;br /&gt;
   AsyncObjectSearchResult searchObj = World.GetNamedObjectList(AssetCategory.TrainCar, &amp;quot;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   // Sniff for search related messages, and then wait for either completion or failure&lt;br /&gt;
   Sniff(searchObj, &amp;quot;ObjectSearch&amp;quot;, &amp;quot;&amp;quot;, true);&lt;br /&gt;
   Message msg;&lt;br /&gt;
   wait()&lt;br /&gt;
   {&lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
     &lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;AsyncLoadComplete&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
   };&lt;br /&gt;
   &lt;br /&gt;
   // Check the results&lt;br /&gt;
   int errCode = searchObj.GetSearchErrorCode();&lt;br /&gt;
   if (errCode != AsyncObjectSearchResult.ERROR_NONE)&lt;br /&gt;
   {&lt;br /&gt;
     // TODO: Add any error handling here, such as waiting and reattempting the&lt;br /&gt;
     // search later, showing an error message, throwing script exceptions, etc.&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // Get the search results&lt;br /&gt;
   NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any processing of the results here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
*[[Class World#GetGameObjectByID|World.GetGameObjectByID()]]&lt;br /&gt;
*[[Class World#GetNamedObjectList|World.GetNamedObjectList()]]&lt;br /&gt;
&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26610</id>
		<title>Class AsyncObjectSearchResult</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_AsyncObjectSearchResult&amp;diff=26610"/>
		<updated>2020-12-28T19:31:36Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Create AsyncObjectSearchResult&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;
****[[Class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
*****[[Class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*An AsyncObjectSearchResult represents an asynchronous search of objects in the game world.&lt;br /&gt;
*[[HowTo/Search for objects in the world]] provides a detailed tutorial on asynchronous searches.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*Messages sent to and from TrackMark 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;|bgcolor=&amp;quot;#EEEEEE&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncResult||AsyncObjectSearchResult||Broadcast||Search is complete, and [[#GetResults|GetResults]] may be called.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||AsyncLoadComplete||AsyncObjectSearchResult||Broadcast||Loading of search result has been completed. See [[Class World#GetGameObjectByID|World.GetGameObjectByID()]].&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Failure||AsyncObjectSearchResult||Broadcast||Search has failed, call [[#GetSearchErrorCode|GetSearchErrorCode]] for more information.&lt;br /&gt;
|-&lt;br /&gt;
|ObjectSearch||Expired||AsyncObjectSearchResult||Broadcast||New search results are available, and this result has expired. Not posted by default - see [[Class World#GetNamedObjectList|World.GetNamedObjectList()]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
===GetResults===&lt;br /&gt;
{{MethodHeader|public native [[Class NamedObjectInfo|NamedObjectInfo]][] GetResults(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Array of search results&lt;br /&gt;
;Syntax&lt;br /&gt;
 NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
 for (int i = 0; i &amp;lt; results.size(); ++i) {&lt;br /&gt;
     NamedObjectInfo result = results[i];&lt;br /&gt;
     Interface.Log(&amp;quot;Result &amp;quot; + i + &amp;quot;: &#039;&amp;quot; + result.localisedUsername + &amp;quot;&#039;&amp;quot;);&lt;br /&gt;
     // Process each result in some useful way...&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*The caller must wait for the search to complete, indicated by the ObjectSearch/AsyncResult message.&lt;br /&gt;
*If the search is not complete, calling this method will result in an exception.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetSearchErrorCode===&lt;br /&gt;
{{MethodHeader|public native int GetSearchErrorCode(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Error code for the query&lt;br /&gt;
;Syntax&lt;br /&gt;
 wait() {&lt;br /&gt;
   on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
     if (msg.src == searchObj) {&lt;br /&gt;
       Interface.Log(&amp;quot;Search error &amp;quot; + searchObj.GetSearchErrorCode();&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
;Notes&lt;br /&gt;
*When a ObjectSearch/Failure message is posted, this method will return an error code.&lt;br /&gt;
*Error codes are defined in the ERROR_ constants for [[Class AsyncQueryHelper|AsyncQueryHelper]].&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;
 thread void SearchForTrains()&lt;br /&gt;
 {&lt;br /&gt;
   // Start a search for any traincars within the world&lt;br /&gt;
   AsyncObjectSearchResult searchObj = World.GetNamedObjectList(AssetCategory.TrainCar, &amp;quot;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   // Sniff for search related messages, and then wait for either completion or failure&lt;br /&gt;
   Sniff(searchObj, &amp;quot;ObjectSearch&amp;quot;, &amp;quot;&amp;quot;, true);&lt;br /&gt;
   Message msg;&lt;br /&gt;
   wait()&lt;br /&gt;
   {&lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
     &lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;AsyncLoadComplete&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
   };&lt;br /&gt;
   &lt;br /&gt;
   // Check the results&lt;br /&gt;
   int errCode = searchObj.GetSearchErrorCode();&lt;br /&gt;
   if (errCode != AsyncObjectSearchResult.ERROR_NONE)&lt;br /&gt;
   {&lt;br /&gt;
     // TODO: Add any error handling here, such as waiting and reattempting the&lt;br /&gt;
     // search later, showing an error message, throwing script exceptions, etc.&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // Get the search results&lt;br /&gt;
   NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any processing of the results here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
*[[Class World#GetGameObjectByID|World.GetGameObjectByID()]]&lt;br /&gt;
*[[Class World#GetNamedObjectList|World.GetNamedObjectList()]]&lt;br /&gt;
&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_NamedObjectInfo&amp;diff=26609</id>
		<title>Class NamedObjectInfo</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_NamedObjectInfo&amp;diff=26609"/>
		<updated>2020-12-28T19:09:23Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Correct class name in text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**NamedObjectInfo&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*NamedObjectInfo is a lightweight class containing a result from an asynchronous object search. It defines only four member fields.&lt;br /&gt;
*NamedObjectInfo is located in &#039;&#039;&#039;asyncobjectsearch.gs&#039;&#039;&#039;.&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 [[Class GameObject|GameObject]] objectRef&amp;lt;/b&amp;gt;||A reference to the object, if it&#039;s loaded&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;public [[Class GameObjectID|GameObjectID]] objectId&amp;lt;/b&amp;gt;||The unique ID of the object&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;public string localisedUsername&amp;lt;/b&amp;gt;||The display name for the object, in the current language&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;public string categoryString&amp;lt;/b&amp;gt;||The category code string for the object&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
* [[Class AsyncObjectSearchResult#GetResults|AsyncObjectSearchResult.GetResults()]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_NamedObjectInfo&amp;diff=26608</id>
		<title>Class NamedObjectInfo</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_NamedObjectInfo&amp;diff=26608"/>
		<updated>2020-12-28T19:01:39Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Create NamedObjectInfo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**NamedObjectInfo&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*NamedObjectInfo is a lightweight class containing a result from an asynchronous object search. It defines only four member fields.&lt;br /&gt;
*TrainUtil is located in &#039;&#039;&#039;asyncobjectsearch.gs&#039;&#039;&#039;.&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 [[Class GameObject|GameObject]] objectRef&amp;lt;/b&amp;gt;||A reference to the object, if it&#039;s loaded&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;public [[Class GameObjectID|GameObjectID]] objectId&amp;lt;/b&amp;gt;||The unique ID of the object&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;public string localisedUsername&amp;lt;/b&amp;gt;||The display name for the object, in the current language&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;b&amp;gt;public string categoryString&amp;lt;/b&amp;gt;||The category code string for the object&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
* [[Class AsyncObjectSearchResult#GetResults|AsyncObjectSearchResult.GetResults()]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26607</id>
		<title>TrainzScript Library Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26607"/>
		<updated>2020-12-28T18:13:35Z</updated>

		<summary type="html">&lt;p&gt;Danny252: AsyncTrainzAssetSearchObject is also a subclass of AsyncQueryHelper&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a list of all classes provided by Auran for use with the Trainz game runtime environment. Some of these classes may not be available from other runtime environments. Please see the [[TrainzScript Language Reference]] for a list of the &amp;quot;core&amp;quot; TrainzScript classes that are present in all runtime environments. This list may not be complete, but will be extended in future.&lt;br /&gt;
&lt;br /&gt;
The source code for all classes can be found within your Trainz installation, under &#039;&#039;resources/scripts&#039;&#039;. Most classes are contained within obviously named files - e.g. the [[Class World|World]] class can be found in &#039;&#039;world.gs&#039;&#039; - although not all classes are in separate files - [[Class TrainUtil|TrainUtil]] is located in &#039;&#039;common.gs&#039;&#039;. Thorough documentation of classes, methods, and constants exists within the source code.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Classes marked with an asterisk have no parent class.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*[[class AssetCategory|AssetCategory]] *&lt;br /&gt;
*[[class GSObject|GSObject]] *&lt;br /&gt;
**[[class Asset|Asset]]&lt;br /&gt;
**[[class DLCInfo|DLCInfo]]&lt;br /&gt;
**[[class GameObjectID|GameObjectID]]&lt;br /&gt;
**[[class GameObject|GameObject]]&lt;br /&gt;
***[[class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
****[[class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
****[[class AsyncTrainzAssetSearchObject|AsyncTrainzAssetSearchObject]]&lt;br /&gt;
***[[class Browser|Browser]]&lt;br /&gt;
***[[class BrowserInterface|BrowserInterface]]&lt;br /&gt;
***[[class CabinControl|CabinControl]]&lt;br /&gt;
***[[class ConstructorsBase|ConstructorsBase]]&lt;br /&gt;
****[[class Constructors|Constructors]]&lt;br /&gt;
***[[class DLCStore|DLCStore]]&lt;br /&gt;
***[[class DriverCommand|DriverCommand]]&lt;br /&gt;
***[[class DriverCommands|DriverCommands]]&lt;br /&gt;
***[[class HTMLPropertyHandler|HTMLProprtyHandler]]&lt;br /&gt;
***[[class Interface|Interface]]&lt;br /&gt;
***[[class InterlockingTowerPath|InterlockingTowerPath]]&lt;br /&gt;
***[[class JunctionBaseGameObject|JunctionBaseGameObject]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
***[[class NavPoints|NavPoints]]&lt;br /&gt;
***[[class ChatChannel|ChatChannel]]&lt;br /&gt;
***[[class OnlineAccess|OnlineAccess]]&lt;br /&gt;
***[[class OnlineGroup|OnlineGroup]]&lt;br /&gt;
***[[class Track|Track]]&lt;br /&gt;
***[[class TrackCircuitBlock|TrackCircuitBlock]]&lt;br /&gt;
***[[class Train|Train]]&lt;br /&gt;
***[[class TrainzAssetSearch|TrainzAssetSearch]]&lt;br /&gt;
***[[class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[class GameplayMenuBase|GameplayMenuBase]]&lt;br /&gt;
*****[[class GameplayMenu|GameplayMenu]]&lt;br /&gt;
*****[[class GameplayMenuMobile|GameplayMenuMobile]]&lt;br /&gt;
****[[class Library|Library]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class OAChat|OAChat]]&lt;br /&gt;
*****[[class Servlet|Servlet]]&lt;br /&gt;
*****[[class SessionVariables|SessionVariables]]&lt;br /&gt;
*****[[class WaybillManager|WaybillManager]]&lt;br /&gt;
****[[class MeshObject|MeshObject]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class Bogey|Bogey]]&lt;br /&gt;
*****[[class Cabin|Cabin]]&lt;br /&gt;
*****[[class MapObject|MapObject]]&lt;br /&gt;
******[[class InterlockingTower|InterlockingTower]]&lt;br /&gt;
******[[class SceneryWithTrack|SceneryWithTrack]]&lt;br /&gt;
*******[[class Buildable|Buildable]]&lt;br /&gt;
********[[class Industry|Industry]]&lt;br /&gt;
*********[[class BaseIndustry|BaseIndustry]]&lt;br /&gt;
**********[[class GenericPassengerStation|GenericPassengerStation]]&lt;br /&gt;
*********[[class BasePortal|BasePortal]]&lt;br /&gt;
*********[[class GenericIndustry|GenericIndustry]]&lt;br /&gt;
*******[[class Crossing|Crossing]]&lt;br /&gt;
*******[[Class_Turntable|TurnTable]]&lt;br /&gt;
******[[class Trackside|Trackside]]&lt;br /&gt;
*******[[class CarSignal|CarSignal]]&lt;br /&gt;
*******[[class Junction|Junction]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
*******[[class Signal|Signal]]&lt;br /&gt;
*******[[class TrackMark|TrackMark]]&lt;br /&gt;
*******[[class Trigger|Trigger]]&lt;br /&gt;
*******[[class Vehicle|Vehicle]]&lt;br /&gt;
********[[class Locomotive|Locomotive]]&lt;br /&gt;
****[[class ModulScript|ModulScript]]&lt;br /&gt;
*****[[class DriverCharacter|DriverCharacter]]&lt;br /&gt;
****[[class ScenarioBehavior|ScenarioBehavior]]&lt;br /&gt;
*****[[class ConditionalScenarioBehavior|ConditionalScenarioBehavior]]&lt;br /&gt;
*****[[class ScenarioBehaviorTemplate|ScenarioBehaviorTemplate]]&lt;br /&gt;
***[[class TrainzScriptBase|TrainzScriptBase]]&lt;br /&gt;
****[[class World|World]]&lt;br /&gt;
***[[class World1|World1]]&lt;br /&gt;
**[[class HTMLBuffer|HTMLBuffer]]&lt;br /&gt;
**[[class IndustryTrainController|IndustryTrainController]]&lt;br /&gt;
**[[class KUID|KUID]]&lt;br /&gt;
**[[class KUIDList|KUIDList]]&lt;br /&gt;
**[[class LoadingReport|LoadingReport]]&lt;br /&gt;
**[[class Menu|Menu]]&lt;br /&gt;
**[[class Permit|Permit]]&lt;br /&gt;
**[[class ProductFilter|ProductFilter]]&lt;br /&gt;
**[[class ProductQueue|ProductQueue]]&lt;br /&gt;
**[[class SecurityToken|SecurityToken]]&lt;br /&gt;
**[[class Soup|Soup]]&lt;br /&gt;
**[[class StringTable|StringTable]]&lt;br /&gt;
**[[class TrackPathDisplay|TrackPathDisplay]]&lt;br /&gt;
**[[class TrainTimeTable|TrainTimeTable]]&lt;br /&gt;
*[[class GSTrackSearch|GSTrackSearch]] *&lt;br /&gt;
*[[class Math|Math]] *&lt;br /&gt;
*[[class NamedObjectInfo|NamedObjectInfo]] *&lt;br /&gt;
*[[class Router|Router]] *&lt;br /&gt;
*[[class Str|Str]] *&lt;br /&gt;
*[[class TrainUtil|TrainUtil]] *&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26606</id>
		<title>TrainzScript Library Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26606"/>
		<updated>2020-12-28T18:12:52Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add NamedObjectInfo, AsyncQueryHelper stubs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a list of all classes provided by Auran for use with the Trainz game runtime environment. Some of these classes may not be available from other runtime environments. Please see the [[TrainzScript Language Reference]] for a list of the &amp;quot;core&amp;quot; TrainzScript classes that are present in all runtime environments. This list may not be complete, but will be extended in future.&lt;br /&gt;
&lt;br /&gt;
The source code for all classes can be found within your Trainz installation, under &#039;&#039;resources/scripts&#039;&#039;. Most classes are contained within obviously named files - e.g. the [[Class World|World]] class can be found in &#039;&#039;world.gs&#039;&#039; - although not all classes are in separate files - [[Class TrainUtil|TrainUtil]] is located in &#039;&#039;common.gs&#039;&#039;. Thorough documentation of classes, methods, and constants exists within the source code.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Classes marked with an asterisk have no parent class.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*[[class AssetCategory|AssetCategory]] *&lt;br /&gt;
*[[class GSObject|GSObject]] *&lt;br /&gt;
**[[class Asset|Asset]]&lt;br /&gt;
**[[class DLCInfo|DLCInfo]]&lt;br /&gt;
**[[class GameObjectID|GameObjectID]]&lt;br /&gt;
**[[class GameObject|GameObject]]&lt;br /&gt;
***[[class AsyncQueryHelper|AsyncQueryHelper]]&lt;br /&gt;
****[[class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
***[[class AsyncTrainzAssetSearchObject|AsyncTrainzAssetSearchObject]]&lt;br /&gt;
***[[class Browser|Browser]]&lt;br /&gt;
***[[class BrowserInterface|BrowserInterface]]&lt;br /&gt;
***[[class CabinControl|CabinControl]]&lt;br /&gt;
***[[class ConstructorsBase|ConstructorsBase]]&lt;br /&gt;
****[[class Constructors|Constructors]]&lt;br /&gt;
***[[class DLCStore|DLCStore]]&lt;br /&gt;
***[[class DriverCommand|DriverCommand]]&lt;br /&gt;
***[[class DriverCommands|DriverCommands]]&lt;br /&gt;
***[[class HTMLPropertyHandler|HTMLProprtyHandler]]&lt;br /&gt;
***[[class Interface|Interface]]&lt;br /&gt;
***[[class InterlockingTowerPath|InterlockingTowerPath]]&lt;br /&gt;
***[[class JunctionBaseGameObject|JunctionBaseGameObject]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
***[[class NavPoints|NavPoints]]&lt;br /&gt;
***[[class ChatChannel|ChatChannel]]&lt;br /&gt;
***[[class OnlineAccess|OnlineAccess]]&lt;br /&gt;
***[[class OnlineGroup|OnlineGroup]]&lt;br /&gt;
***[[class Track|Track]]&lt;br /&gt;
***[[class TrackCircuitBlock|TrackCircuitBlock]]&lt;br /&gt;
***[[class Train|Train]]&lt;br /&gt;
***[[class TrainzAssetSearch|TrainzAssetSearch]]&lt;br /&gt;
***[[class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[class GameplayMenuBase|GameplayMenuBase]]&lt;br /&gt;
*****[[class GameplayMenu|GameplayMenu]]&lt;br /&gt;
*****[[class GameplayMenuMobile|GameplayMenuMobile]]&lt;br /&gt;
****[[class Library|Library]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class OAChat|OAChat]]&lt;br /&gt;
*****[[class Servlet|Servlet]]&lt;br /&gt;
*****[[class SessionVariables|SessionVariables]]&lt;br /&gt;
*****[[class WaybillManager|WaybillManager]]&lt;br /&gt;
****[[class MeshObject|MeshObject]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class Bogey|Bogey]]&lt;br /&gt;
*****[[class Cabin|Cabin]]&lt;br /&gt;
*****[[class MapObject|MapObject]]&lt;br /&gt;
******[[class InterlockingTower|InterlockingTower]]&lt;br /&gt;
******[[class SceneryWithTrack|SceneryWithTrack]]&lt;br /&gt;
*******[[class Buildable|Buildable]]&lt;br /&gt;
********[[class Industry|Industry]]&lt;br /&gt;
*********[[class BaseIndustry|BaseIndustry]]&lt;br /&gt;
**********[[class GenericPassengerStation|GenericPassengerStation]]&lt;br /&gt;
*********[[class BasePortal|BasePortal]]&lt;br /&gt;
*********[[class GenericIndustry|GenericIndustry]]&lt;br /&gt;
*******[[class Crossing|Crossing]]&lt;br /&gt;
*******[[Class_Turntable|TurnTable]]&lt;br /&gt;
******[[class Trackside|Trackside]]&lt;br /&gt;
*******[[class CarSignal|CarSignal]]&lt;br /&gt;
*******[[class Junction|Junction]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
*******[[class Signal|Signal]]&lt;br /&gt;
*******[[class TrackMark|TrackMark]]&lt;br /&gt;
*******[[class Trigger|Trigger]]&lt;br /&gt;
*******[[class Vehicle|Vehicle]]&lt;br /&gt;
********[[class Locomotive|Locomotive]]&lt;br /&gt;
****[[class ModulScript|ModulScript]]&lt;br /&gt;
*****[[class DriverCharacter|DriverCharacter]]&lt;br /&gt;
****[[class ScenarioBehavior|ScenarioBehavior]]&lt;br /&gt;
*****[[class ConditionalScenarioBehavior|ConditionalScenarioBehavior]]&lt;br /&gt;
*****[[class ScenarioBehaviorTemplate|ScenarioBehaviorTemplate]]&lt;br /&gt;
***[[class TrainzScriptBase|TrainzScriptBase]]&lt;br /&gt;
****[[class World|World]]&lt;br /&gt;
***[[class World1|World1]]&lt;br /&gt;
**[[class HTMLBuffer|HTMLBuffer]]&lt;br /&gt;
**[[class IndustryTrainController|IndustryTrainController]]&lt;br /&gt;
**[[class KUID|KUID]]&lt;br /&gt;
**[[class KUIDList|KUIDList]]&lt;br /&gt;
**[[class LoadingReport|LoadingReport]]&lt;br /&gt;
**[[class Menu|Menu]]&lt;br /&gt;
**[[class Permit|Permit]]&lt;br /&gt;
**[[class ProductFilter|ProductFilter]]&lt;br /&gt;
**[[class ProductQueue|ProductQueue]]&lt;br /&gt;
**[[class SecurityToken|SecurityToken]]&lt;br /&gt;
**[[class Soup|Soup]]&lt;br /&gt;
**[[class StringTable|StringTable]]&lt;br /&gt;
**[[class TrackPathDisplay|TrackPathDisplay]]&lt;br /&gt;
**[[class TrainTimeTable|TrainTimeTable]]&lt;br /&gt;
*[[class GSTrackSearch|GSTrackSearch]] *&lt;br /&gt;
*[[class Math|Math]] *&lt;br /&gt;
*[[class NamedObjectInfo|NamedObjectInfo]] *&lt;br /&gt;
*[[class Router|Router]] *&lt;br /&gt;
*[[class Str|Str]] *&lt;br /&gt;
*[[class TrainUtil|TrainUtil]] *&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=HowTo/Search_for_objects_in_the_world&amp;diff=26605</id>
		<title>HowTo/Search for objects in the world</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=HowTo/Search_for_objects_in_the_world&amp;diff=26605"/>
		<updated>2020-12-28T18:07:51Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Named Object Searches */ Correct code example - referred to undefined &amp;#039;asyncSearch&amp;#039; object&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Scripted asset may sometimes wish to search for other objects within the world, either in bulk lists, or for a specific single object. This page is intended to provide an overview of how this is achieved in the latest versions of Trainz. Details about certain legacy search methods and the best modern techniques to update them to are also provided in the final section of this page.&lt;br /&gt;
&lt;br /&gt;
==Object Identification==&lt;br /&gt;
Scripted objects identified in script using several different methods, many of which have become obsolete as Trainz and the script environment has grown in complexity. As of trainz-build 4.5 (TANE SP2 and later) scripted objects should be identified using their GameObjectID, where present. This ID format has been designed to be future-proof/extensible, should the need arise, and supports various lookup and generic storage functions as per the legacy integer and string based IDs. For more information about legacy ID formats, see [[HowTo/Search_for_objects_in_the_world#Legacy_Search_Functions|here]].&lt;br /&gt;
&lt;br /&gt;
The GameObjectID class is defined within GameObjectID.gs, which can be found in the Trainz core script folder (resources/scripts). For the most up to date and accurate usage instructions please see the comments within that file.&lt;br /&gt;
&lt;br /&gt;
==Named Object Searches==&lt;br /&gt;
It is occasionally desirable for scripted assets to be able to search for objects within the world. Most commonly, this is a requirement of session rules, which frequently require a session creator to specify target trains, junctions, signals, etc, in order to perform some gameplay function. Occasionally, placable assets such as industries etc may also require this feature. One such example is the Interlocking Tower asset type, which performs complex management of track blocks using management of user defined signals, junctions and crossings.&lt;br /&gt;
&lt;br /&gt;
As of trainz-build 4.5 (TANE SP2 and later) manual object searches are performed via the World.GetNamedObjectList() function. This function takes both a [[Category_List|category list]] and a partial name, allowing for very specific searches, or quite broad ones. Once called, this function returns an object of type AsyncObjectSearchResult, which is used to monitor for the search completion, and then to retrieve the results. For the most up to date and accurate information on how to use GetNamedObjectList and AsyncObjectSearchResult, please see their script comments. Both are currently defined in World.gs, which can be found in the Trainz core script folder (resources/scripts).&lt;br /&gt;
&lt;br /&gt;
Usage example:&lt;br /&gt;
&lt;br /&gt;
 thread void SearchForTrains()&lt;br /&gt;
 {&lt;br /&gt;
   // Start a search for any traincars within the world&lt;br /&gt;
   AsyncObjectSearchResult searchObj = World.GetNamedObjectList(AssetCategory.TrainCar, &amp;quot;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   // Sniff for search related messages, and then wait for either completion or failure&lt;br /&gt;
   Sniff(searchObj, &amp;quot;ObjectSearch&amp;quot;, &amp;quot;&amp;quot;, true);&lt;br /&gt;
   Message msg;&lt;br /&gt;
   wait()&lt;br /&gt;
   {&lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;Failure&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
     &lt;br /&gt;
     on &amp;quot;ObjectSearch&amp;quot;, &amp;quot;AsyncLoadComplete&amp;quot;, msg:&lt;br /&gt;
       if (msg.src == searchObj)&lt;br /&gt;
         break;&lt;br /&gt;
       continue;&lt;br /&gt;
   };&lt;br /&gt;
   &lt;br /&gt;
   // Check the results&lt;br /&gt;
   int errCode = searchObj.GetSearchErrorCode();&lt;br /&gt;
   if (errCode != AsyncObjectSearchResult.ERROR_NONE)&lt;br /&gt;
   {&lt;br /&gt;
     // TODO: Add any error handling here, such as waiting and reattempting the&lt;br /&gt;
     // search later, showing an error message, throwing script exceptions, etc.&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // Get the search results&lt;br /&gt;
   NamedObjectInfo[] results = searchObj.GetResults();&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any processing of the results here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Storing References to Specific Objects==&lt;br /&gt;
As shown in the example above, named object searches return their results as an array of NamedObjectInfo objects. Currently, this class has 4 member variables:&lt;br /&gt;
* objectRef - A reference to the object, if it is currently loaded&lt;br /&gt;
* objectId - The GameObjectID for the object (see GameObjectID.gs)&lt;br /&gt;
* localisedUsername - The localised name of the object, for displaying to the player&lt;br /&gt;
* categoryString - A category string, usable to further determine the exact type and features of the object&lt;br /&gt;
&lt;br /&gt;
Any script which wishes to save a reference to specific named object should /always/ do so via the GameObjectID. This is currently the /only/ safe and reliable way to store and later retrieve a specific object. If the object is currently loaded it is of course also safe to access and store a reference to the object itself, but note that Trainz may choose to unload the object at any time (if it is inactive, and sufficiently far enough away from the player, etc). Attempts to use an object which native code has unloaded may result in native call errors. To avoid this scripts should call Router.DoesGameObjectStillExist() before attempting to use any object reference that has been stored for some time.&lt;br /&gt;
&lt;br /&gt;
Unlike the named object itself, a referenced GameObjectID will never be deleted by native code, and may be held by a script indefinitely. It can also be stored directly into a [[Soup]] database for storage and retrieval between runs of the game, over a network, etc. For details about saving a GameObjectID into a Soup database please see the comments in Soup.gs, located in the core Trainz script folder (resources/scripts).&lt;br /&gt;
&lt;br /&gt;
In addition to Soup storage, a GameObjectID can be serialised to a string for *temporary* storage. This allows scripts to do thing like store the ID directly in a trainzhttp link, etc (provided it is also appropriately escaped). However, it is crucial to note that the format of this string is *not* guaranteed and may change between versions of the game. As such, no attempt should be made to machine parse it, save it between runs or send it over a network. To convert the string back into a GameObjectID, use Router.SerialiseGameObjectIDFromString().&lt;br /&gt;
&lt;br /&gt;
It is also safe to cache and store the localised display name for an object, but it is important to remember that objects can be renamed, and that this object name may become out of date at any time. As such, scripts which store it should remember to update their cache whenever an opportunity arises (e.g. during any validation steps).&lt;br /&gt;
&lt;br /&gt;
==Searching for Specific Objects by ID==&lt;br /&gt;
Several functions exist for looking up an object which has been saved via it&#039;s GameObjectID. Each of these serves a slightly different use-case, so it&#039;s important to understand them all before selecting the one that best suits the needs of a specific script.&lt;br /&gt;
&lt;br /&gt;
Two functions exist to retrieve a loaded object via it&#039;s ID. These both behave identically, and will return a reference to a matching object *only* if that object exists and is currently loaded. In all other cases the functions will return null. There is no way to determine the cause of a null result using this function.&lt;br /&gt;
&lt;br /&gt;
 GameObject objectRef1 = World.GetGameObjectByIDIfLoaded(mySavedID);&lt;br /&gt;
 &lt;br /&gt;
 GameObject objectRef2 = Router.GetGameObject(mySavedID);&lt;br /&gt;
&lt;br /&gt;
Another function exists to allow scripts to search for objects which are not currently loaded, and to optionally request that they are loaded. Scripts should only request loading of objects when absolutely necessary, and scripts which abuse this feature may have their requests ignored by native code in order to maintain performance. As this function may take a considerable amount of time to run, it uses an AsyncObjectSearchResult, much like the named object list functions described above.&lt;br /&gt;
&lt;br /&gt;
 AsyncObjectSearchResult searchObj = World.GetGameObjectByID(mySavedID, false);&lt;br /&gt;
&lt;br /&gt;
As with GetNamedObjectList(), calling scripts must Sniff the returned search object and wait for the appropriate result message(s) to be posted. To avoid the need for frequent code duplication another function also exists which allows threaded objects to perform this functionality in a pseudo-synchronous way.&lt;br /&gt;
&lt;br /&gt;
 GameObject loadedObjectRef = World.SynchronouslyLoadGameObjectByID(mySavedID);&lt;br /&gt;
&lt;br /&gt;
This function will throw exceptions if used incorrectly (e.g. if called outside of a thread function) so be sure to read and understand the comments on the function itself, before attempting to use it.&lt;br /&gt;
&lt;br /&gt;
==Script Library Lookups==&lt;br /&gt;
Script [[KIND_Library|library assets]] are unique within script in that they exist without any visual presence to the end player, and are shared across all scripts that access them. i.e. It is not possible to instantiate multiple instances of the same library asset within a single script context. This makes them extremely useful for managing, organising or communicating between other scripted asset types. For more information about library assets, see the [[KIND_Library]] page.&lt;br /&gt;
&lt;br /&gt;
As libraries are added to the world by script, and the not the player or session creator, they require a script accessible function to create and load them. This function is TrainzScriptBase.GetLibrary(). When this function is called the library asset will be immediately loaded and returned by Trainz native code. Once loaded, the library will remain loaded in script, and any future calls to GetLibrary() will return the same instance.&lt;br /&gt;
&lt;br /&gt;
Example usage:&lt;br /&gt;
 public void Init(Asset asset)&lt;br /&gt;
 {&lt;br /&gt;
   inherited(asset);&lt;br /&gt;
   &lt;br /&gt;
   // Load our shared library asset&lt;br /&gt;
   KUID libraryKuid = asset.LookupKUIDTable(&amp;quot;shared-library&amp;quot;);&lt;br /&gt;
   m_sharedLibrary = World.GetLibrary(libraryKuid);&lt;br /&gt;
   &lt;br /&gt;
   // TODO: Add any library specific init, registration, etc code here&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Legacy Search Functions==&lt;br /&gt;
Prior to trainz-build 4.5 (TANE SP1 and earlier) all world objects were loaded on Route/Session load, and remained that way until the session was ended. As Routes grow larger and larger this technique becomes unmanageable, and it is thus necessary for Trainz (and it&#039;s scripted assets) to support the unloading of objects which are not currently gameplay relevant. As a result of this, numerous script functions have been declared obsolete, as they are incompatible with this concept. Below is a summary of these functions and a mention of their modern replacements.&lt;br /&gt;
&lt;br /&gt;
=====GameObject.GetId()=====&lt;br /&gt;
All GameObject instances with a Router are assigned a numeric integer ID. This ID was traditionally retrieved via this function. As the ID varies between runs it was never safe for long term storage, but it was suitable for short term storage and lookup. As objects can now be unloaded at any time, and these IDs then reused by totally different objects, the function has been declared obsolete. Any scripts which use it should be updated to instead use GameObjectID and the related storage functions. See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====GameObject.GetName()=====&lt;br /&gt;
In addition to their integer ID certain GameObject types also supported a &amp;quot;script name&amp;quot;, which was generally automatically assigned on creation, but could also be edited by the player in some scenarios. Despite the script comments in certain older versions of Trainz, this name was never /guaranteed/ unique, but it was generally considered to be so for ease of use (and that assumption rarely failed). This script name was typically used for object identification in medium to long term storage, including within Soups for session config, savegames, etc. Any scripts which use it should be updated to instead use GameObjectID and the related storage functions. See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====Router.GetGameObject(int)=====&lt;br /&gt;
Much like GetGameObject(GameObjectID), this function would return any loaded object with the integer Router ID passed. As this ID format is now considered obsolete, so is this lookup function. Any scripts which use it should be updated to instead use GameObjectID and that function variant (or the async search functions on World). See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====Router.GetGameObject(string)=====&lt;br /&gt;
Much like GetGameObject(GameObjectID), this function would return any loaded object with the &amp;quot;script name&amp;quot; string passed. As this ID format is now considered obsolete, so is this lookup function. Any scripts which use it should be updated to instead use GameObjectID and that function variant (or the async search functions on World). See the comments on GameObjectID.gs for more information.&lt;br /&gt;
&lt;br /&gt;
=====World.Get*List()=====&lt;br /&gt;
Prior to GetNamedObjectList() multiple functions existed on World to manually retrieve lists of objects of a specific type(e.g. GetIndustryList(), GetTrainList(), etc). These search functions were slow, and scripts would often stall Trainz while the searches were performed. Because of this, and the fact that the functions can now only return those objects that currently loaded, they have been declared obsolete. Any scripts which use them for custom functionality should be updated to instead use World.GetNamedObjectList(). See the comments on this function and the AsyncObjectSearchResult in World.gs for more information on their use. Alternatively, any scripts using them for PropertyObject &amp;quot;list&amp;quot; types may be better served by the new &amp;quot;map-object&amp;quot; type, detailed [[PropertyObject#GetPropertyType|here]].&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[Asynchronous_Route_Streaming| Asynchronous Route Streaming]]&lt;br /&gt;
&lt;br /&gt;
[[Category:How-to_guides|HowTo Guides]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_TrackMark&amp;diff=26604</id>
		<title>Class TrackMark</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_TrackMark&amp;diff=26604"/>
		<updated>2020-12-28T17:31:09Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Link to messages documentation&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;
****[[Class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[Class PropertyObject|PropertyObject]] *&lt;br /&gt;
*****[[Class MeshObject|MeshObject]]&lt;br /&gt;
******[[Class MapObject|MapObject]]&lt;br /&gt;
*******[[Class Trackside|Trackside]]&lt;br /&gt;
********[[Class TrackMark|TrackMark]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*A class representing Track Mark items&lt;br /&gt;
*This class implements no new methods, and uses the generic methods from the [[Class Trackside|Trackside]] class instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*Messages sent to and from TrackMark 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;
|[[Object Messages|TrackMark]]||Enter||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|TrackMark]]||Stopped||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|TrackMark]]||Leave||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||Enter||train||track mark&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||Stopped||train||track mark&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||Leave||train||track mark&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_TrackMark&amp;diff=26603</id>
		<title>Class TrackMark</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_TrackMark&amp;diff=26603"/>
		<updated>2020-12-28T17:29:33Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Fix formatting&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;
****[[Class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[Class PropertyObject|PropertyObject]] *&lt;br /&gt;
*****[[Class MeshObject|MeshObject]]&lt;br /&gt;
******[[Class MapObject|MapObject]]&lt;br /&gt;
*******[[Class Trackside|Trackside]]&lt;br /&gt;
********[[Class TrackMark|TrackMark]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*A class representing Track Mark items&lt;br /&gt;
*This class implements no new methods, and uses the generic methods from the [[Class Trackside|Trackside]] class instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*Messages sent to and from TrackMark 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;
|TrackMark||Enter||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|TrackMark||Stopped||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|TrackMark||Leave||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|Object||Enter||train||track mark&lt;br /&gt;
|-&lt;br /&gt;
|Object||Stopped||train||track mark&lt;br /&gt;
|-&lt;br /&gt;
|Object||Leave||train||track mark&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_TrackMark&amp;diff=26602</id>
		<title>Class TrackMark</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_TrackMark&amp;diff=26602"/>
		<updated>2020-12-28T17:28:55Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Create TrackMark class docs&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;
****[[Class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[Class PropertyObject|PropertyObject]] *&lt;br /&gt;
*****[[Class MeshObject|MeshObject]]&lt;br /&gt;
******[[Class MapObject|MapObject]]&lt;br /&gt;
*******[[Class Trackside|Trackside]]&lt;br /&gt;
********[[Class TrackMark|TrackMark]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*A class representing Track Mark items&lt;br /&gt;
*This class implements no new methods, and uses the generic methods from the [[Class Trackside|Trackside]] class instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
==Messages==&lt;br /&gt;
*Messages sent to and from TrackMark 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;
|TrackMark||Enter||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|TrackMark||Stopped||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|TrackMark||Leave||track mark||train&lt;br /&gt;
|-&lt;br /&gt;
|Object||Enter||train||track mark&lt;br /&gt;
|-&lt;br /&gt;
|Object||Stopped||train||track mark&lt;br /&gt;
|-&lt;br /&gt;
|Object||Leave||train||track mark&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_GSTrackSearch&amp;diff=26601</id>
		<title>Class GSTrackSearch</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_GSTrackSearch&amp;diff=26601"/>
		<updated>2020-12-28T17:26:21Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Undo revision 26600 by Danny252 (talk)  -  Wrong class&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**GSTrackSearch&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*A class enabling the searching of a length of track for [[class Trackside|Trackside]] items. &lt;br /&gt;
*The GSTrackSearch class provides an interface to access certain items along a track in a specified direction from an existing trackside item. &lt;br /&gt;
*A GSTrackSearch object can be obtained by calling the [[Class Trackside#BeginTrackSearch|BeginTrackSearch()]] method on the [[class Trackside|Trackside]] item that you want to start your search from. &lt;br /&gt;
*The SearchNext() and GetMapObject() methods are provided to get a reference to a discovered [[class Trackside|Trackside]] object.&lt;br /&gt;
*The reference returned by these methods can be cast to [[class Trackside|Trackside]] child classes to find out if that item is in fact a [[class Signal|Signal]] or a [[class Junction|Junction]] for instance. As the script code doesn&#039;t know what the next item will be, always verify the cast. &lt;br /&gt;
*Since [[class Vehicle|Vehicles]] and [[Class Locomotive|Locomotives]] descend from [[class Trackside|Trackside]], searches can be initiated from rolling stock and rolling stock will be returned.&lt;br /&gt;
*GSTrackSearch methods will also find [[Class SceneryWithTrack|SceneryWithTrack]] and descendants, although the information which can be obtained from them is limited and these objects cannot be used to initiate a search.&lt;br /&gt;
*The search will continue (following the direction set by any junctions) until it is blocked by:&lt;br /&gt;
**A junction set against the track&lt;br /&gt;
**A turntable.&lt;br /&gt;
**A crossing. *** ? &amp;quot;crossing&amp;quot; appears to mean a track (diamond, etc), rather than a road (grade, level) crossing, since the function appears to work properly across road crossings. &lt;br /&gt;
**The end of the line.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*See [[TrackSearch]] for details of enhancements being developed for future versions of the game.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Trackside.BeginTrackSearch==&lt;br /&gt;
{{MethodHeader|public native GSTrackSearch Trackside.BeginTrackSearch(bool direction)}}&lt;br /&gt;
*This method is called on objects descending from the [[class Trackside|Trackside]] class to obtain a GSTrackSearch object in the specified search direction.&lt;br /&gt;
*See [[Class Trackside#BeginTrackSearch|Trackside.BeginTrackSearch()]] for details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDistance==&lt;br /&gt;
{{MethodHeader|public native float GetDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The distance in metres from the origin of the search to the object at which the search cursor is currently pointing.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float distance = gst.GetDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[#Code Examples|Code Examples]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetFacingRelativeToSearchDirection==&lt;br /&gt;
{{MethodHeader|public native bool GetFacingRelativeToSearchDirection(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the returned object orientation matches the direction of search, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool facing = gst.GetFacingRelativeToSearchDirection();&lt;br /&gt;
;Notes&lt;br /&gt;
*Note that it is the direction of the search that matters, not the facing direction of the search origin.&lt;br /&gt;
*A search forwards from a fixed object such as a [[Class Trigger|Trigger]] will return &#039;&#039;&#039;true&#039;&#039;&#039; for any returned trigger which has the same orientation as the source. &lt;br /&gt;
*A search backwards from a fixed object such as a [[Class Trigger|Trigger]] will return &#039;&#039;&#039;false&#039;&#039;&#039; for any returned trigger which has the same orientation as the source. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetMapObject==&lt;br /&gt;
{{MethodHeader|public native MapObject GetMapObject(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to a MapObject or null if nothing has been found.&lt;br /&gt;
;Syntax&lt;br /&gt;
 MapObject mo = gst.GetMapObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*MapObject returns Trackside descendants including Vehicles and SceneryWithTrack descendants including Industries.&lt;br /&gt;
*Ensure that you attempt a cast to SceneryWithTrack and Trackside if you want the maximum possible amount of information from the search.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SearchNext==&lt;br /&gt;
{{MethodHeader|public native MapObject SearchNext(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to a MapObject or null if nothing has been found.&lt;br /&gt;
;Syntax&lt;br /&gt;
 MapObject mo = gst.GetMapObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*SearchNext moves the search cursor to the next object if such an object exists.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
*GSTrackSearch will return a null reference if it finds certain types of [[Class Crossing|Crossing]] objects, but will continue searching beyond them if asked.  As a result of this it is often necessary to make repeated calls to SearchNext following a null return to decide whether you have reached the end of the track or whether your search has simply been interrupted by one or more crossings.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Examples==&lt;br /&gt;
*This code fragment implements a search forwards from a locomotive. The distance from the locomotive to any discovered object is printed to &#039;&#039;jetlog.txt&#039;&#039;&lt;br /&gt;
*The process continues until the search returns a null value (which might be a crossing or the end of the track) or the distance from the train exceeds 1km.&lt;br /&gt;
 GSTrackSearch gst = Loco.BeginTrackSearch(true);          // obtain a GSTrackSearch object&lt;br /&gt;
 MapObject mo = gst.SearchNext();                          // initiate the search&lt;br /&gt;
 while (mo) {                                              // continue as long as objects are present&lt;br /&gt;
   float distance = gst.GetDistance();                      // how far ahead the object is&lt;br /&gt;
   if (distance &amp;gt; 1000.0) break;                         // break from the loop if the distance exceeds 1km&lt;br /&gt;
   Interface.Print(&amp;quot;object found at &amp;quot; distance &amp;quot; metres&amp;quot;); // print out the results&lt;br /&gt;
   mo = gst.SearchNext();                                  // search for the next object&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
[[Class Trackside#BeginTrackSearch|Trackside.BeginTrackSearch()]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_GSTrackSearch&amp;diff=26600</id>
		<title>Class GSTrackSearch</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_GSTrackSearch&amp;diff=26600"/>
		<updated>2020-12-28T17:24:09Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add full hierarchy&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;
****[[Class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[Class PropertyObject|PropertyObject]] *&lt;br /&gt;
*****[[Class MeshObject|MeshObject]]&lt;br /&gt;
******[[Class MapObject|MapObject]]&lt;br /&gt;
*******[[Class Trackside|Trackside]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*A class enabling the searching of a length of track for [[class Trackside|Trackside]] items. &lt;br /&gt;
*The GSTrackSearch class provides an interface to access certain items along a track in a specified direction from an existing trackside item. &lt;br /&gt;
*A GSTrackSearch object can be obtained by calling the [[Class Trackside#BeginTrackSearch|BeginTrackSearch()]] method on the [[class Trackside|Trackside]] item that you want to start your search from. &lt;br /&gt;
*The SearchNext() and GetMapObject() methods are provided to get a reference to a discovered [[class Trackside|Trackside]] object.&lt;br /&gt;
*The reference returned by these methods can be cast to [[class Trackside|Trackside]] child classes to find out if that item is in fact a [[class Signal|Signal]] or a [[class Junction|Junction]] for instance. As the script code doesn&#039;t know what the next item will be, always verify the cast. &lt;br /&gt;
*Since [[class Vehicle|Vehicles]] and [[Class Locomotive|Locomotives]] descend from [[class Trackside|Trackside]], searches can be initiated from rolling stock and rolling stock will be returned.&lt;br /&gt;
*GSTrackSearch methods will also find [[Class SceneryWithTrack|SceneryWithTrack]] and descendants, although the information which can be obtained from them is limited and these objects cannot be used to initiate a search.&lt;br /&gt;
*The search will continue (following the direction set by any junctions) until it is blocked by:&lt;br /&gt;
**A junction set against the track&lt;br /&gt;
**A turntable.&lt;br /&gt;
**A crossing. *** ? &amp;quot;crossing&amp;quot; appears to mean a track (diamond, etc), rather than a road (grade, level) crossing, since the function appears to work properly across road crossings. &lt;br /&gt;
**The end of the line.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*See [[TrackSearch]] for details of enhancements being developed for future versions of the game.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Trackside.BeginTrackSearch==&lt;br /&gt;
{{MethodHeader|public native GSTrackSearch Trackside.BeginTrackSearch(bool direction)}}&lt;br /&gt;
*This method is called on objects descending from the [[class Trackside|Trackside]] class to obtain a GSTrackSearch object in the specified search direction.&lt;br /&gt;
*See [[Class Trackside#BeginTrackSearch|Trackside.BeginTrackSearch()]] for details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDistance==&lt;br /&gt;
{{MethodHeader|public native float GetDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The distance in metres from the origin of the search to the object at which the search cursor is currently pointing.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float distance = gst.GetDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[#Code Examples|Code Examples]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetFacingRelativeToSearchDirection==&lt;br /&gt;
{{MethodHeader|public native bool GetFacingRelativeToSearchDirection(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the returned object orientation matches the direction of search, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool facing = gst.GetFacingRelativeToSearchDirection();&lt;br /&gt;
;Notes&lt;br /&gt;
*Note that it is the direction of the search that matters, not the facing direction of the search origin.&lt;br /&gt;
*A search forwards from a fixed object such as a [[Class Trigger|Trigger]] will return &#039;&#039;&#039;true&#039;&#039;&#039; for any returned trigger which has the same orientation as the source. &lt;br /&gt;
*A search backwards from a fixed object such as a [[Class Trigger|Trigger]] will return &#039;&#039;&#039;false&#039;&#039;&#039; for any returned trigger which has the same orientation as the source. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetMapObject==&lt;br /&gt;
{{MethodHeader|public native MapObject GetMapObject(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to a MapObject or null if nothing has been found.&lt;br /&gt;
;Syntax&lt;br /&gt;
 MapObject mo = gst.GetMapObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*MapObject returns Trackside descendants including Vehicles and SceneryWithTrack descendants including Industries.&lt;br /&gt;
*Ensure that you attempt a cast to SceneryWithTrack and Trackside if you want the maximum possible amount of information from the search.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SearchNext==&lt;br /&gt;
{{MethodHeader|public native MapObject SearchNext(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to a MapObject or null if nothing has been found.&lt;br /&gt;
;Syntax&lt;br /&gt;
 MapObject mo = gst.GetMapObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*SearchNext moves the search cursor to the next object if such an object exists.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
*GSTrackSearch will return a null reference if it finds certain types of [[Class Crossing|Crossing]] objects, but will continue searching beyond them if asked.  As a result of this it is often necessary to make repeated calls to SearchNext following a null return to decide whether you have reached the end of the track or whether your search has simply been interrupted by one or more crossings.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Examples==&lt;br /&gt;
*This code fragment implements a search forwards from a locomotive. The distance from the locomotive to any discovered object is printed to &#039;&#039;jetlog.txt&#039;&#039;&lt;br /&gt;
*The process continues until the search returns a null value (which might be a crossing or the end of the track) or the distance from the train exceeds 1km.&lt;br /&gt;
 GSTrackSearch gst = Loco.BeginTrackSearch(true);          // obtain a GSTrackSearch object&lt;br /&gt;
 MapObject mo = gst.SearchNext();                          // initiate the search&lt;br /&gt;
 while (mo) {                                              // continue as long as objects are present&lt;br /&gt;
   float distance = gst.GetDistance();                      // how far ahead the object is&lt;br /&gt;
   if (distance &amp;gt; 1000.0) break;                         // break from the loop if the distance exceeds 1km&lt;br /&gt;
   Interface.Print(&amp;quot;object found at &amp;quot; distance &amp;quot; metres&amp;quot;); // print out the results&lt;br /&gt;
   mo = gst.SearchNext();                                  // search for the next object&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
[[Class Trackside#BeginTrackSearch|Trackside.BeginTrackSearch()]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_GSTrackSearch&amp;diff=26599</id>
		<title>Class GSTrackSearch</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_GSTrackSearch&amp;diff=26599"/>
		<updated>2020-12-28T17:23:01Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Change link to library reference, not language reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**GSTrackSearch&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*A class enabling the searching of a length of track for [[class Trackside|Trackside]] items. &lt;br /&gt;
*The GSTrackSearch class provides an interface to access certain items along a track in a specified direction from an existing trackside item. &lt;br /&gt;
*A GSTrackSearch object can be obtained by calling the [[Class Trackside#BeginTrackSearch|BeginTrackSearch()]] method on the [[class Trackside|Trackside]] item that you want to start your search from. &lt;br /&gt;
*The SearchNext() and GetMapObject() methods are provided to get a reference to a discovered [[class Trackside|Trackside]] object.&lt;br /&gt;
*The reference returned by these methods can be cast to [[class Trackside|Trackside]] child classes to find out if that item is in fact a [[class Signal|Signal]] or a [[class Junction|Junction]] for instance. As the script code doesn&#039;t know what the next item will be, always verify the cast. &lt;br /&gt;
*Since [[class Vehicle|Vehicles]] and [[Class Locomotive|Locomotives]] descend from [[class Trackside|Trackside]], searches can be initiated from rolling stock and rolling stock will be returned.&lt;br /&gt;
*GSTrackSearch methods will also find [[Class SceneryWithTrack|SceneryWithTrack]] and descendants, although the information which can be obtained from them is limited and these objects cannot be used to initiate a search.&lt;br /&gt;
*The search will continue (following the direction set by any junctions) until it is blocked by:&lt;br /&gt;
**A junction set against the track&lt;br /&gt;
**A turntable.&lt;br /&gt;
**A crossing. *** ? &amp;quot;crossing&amp;quot; appears to mean a track (diamond, etc), rather than a road (grade, level) crossing, since the function appears to work properly across road crossings. &lt;br /&gt;
**The end of the line.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*See [[TrackSearch]] for details of enhancements being developed for future versions of the game.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Trackside.BeginTrackSearch==&lt;br /&gt;
{{MethodHeader|public native GSTrackSearch Trackside.BeginTrackSearch(bool direction)}}&lt;br /&gt;
*This method is called on objects descending from the [[class Trackside|Trackside]] class to obtain a GSTrackSearch object in the specified search direction.&lt;br /&gt;
*See [[Class Trackside#BeginTrackSearch|Trackside.BeginTrackSearch()]] for details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDistance==&lt;br /&gt;
{{MethodHeader|public native float GetDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The distance in metres from the origin of the search to the object at which the search cursor is currently pointing.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float distance = gst.GetDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[#Code Examples|Code Examples]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetFacingRelativeToSearchDirection==&lt;br /&gt;
{{MethodHeader|public native bool GetFacingRelativeToSearchDirection(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the returned object orientation matches the direction of search, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool facing = gst.GetFacingRelativeToSearchDirection();&lt;br /&gt;
;Notes&lt;br /&gt;
*Note that it is the direction of the search that matters, not the facing direction of the search origin.&lt;br /&gt;
*A search forwards from a fixed object such as a [[Class Trigger|Trigger]] will return &#039;&#039;&#039;true&#039;&#039;&#039; for any returned trigger which has the same orientation as the source. &lt;br /&gt;
*A search backwards from a fixed object such as a [[Class Trigger|Trigger]] will return &#039;&#039;&#039;false&#039;&#039;&#039; for any returned trigger which has the same orientation as the source. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetMapObject==&lt;br /&gt;
{{MethodHeader|public native MapObject GetMapObject(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to a MapObject or null if nothing has been found.&lt;br /&gt;
;Syntax&lt;br /&gt;
 MapObject mo = gst.GetMapObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*MapObject returns Trackside descendants including Vehicles and SceneryWithTrack descendants including Industries.&lt;br /&gt;
*Ensure that you attempt a cast to SceneryWithTrack and Trackside if you want the maximum possible amount of information from the search.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SearchNext==&lt;br /&gt;
{{MethodHeader|public native MapObject SearchNext(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to a MapObject or null if nothing has been found.&lt;br /&gt;
;Syntax&lt;br /&gt;
 MapObject mo = gst.GetMapObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*SearchNext moves the search cursor to the next object if such an object exists.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Known Issues==&lt;br /&gt;
*GSTrackSearch will return a null reference if it finds certain types of [[Class Crossing|Crossing]] objects, but will continue searching beyond them if asked.  As a result of this it is often necessary to make repeated calls to SearchNext following a null return to decide whether you have reached the end of the track or whether your search has simply been interrupted by one or more crossings.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Examples==&lt;br /&gt;
*This code fragment implements a search forwards from a locomotive. The distance from the locomotive to any discovered object is printed to &#039;&#039;jetlog.txt&#039;&#039;&lt;br /&gt;
*The process continues until the search returns a null value (which might be a crossing or the end of the track) or the distance from the train exceeds 1km.&lt;br /&gt;
 GSTrackSearch gst = Loco.BeginTrackSearch(true);          // obtain a GSTrackSearch object&lt;br /&gt;
 MapObject mo = gst.SearchNext();                          // initiate the search&lt;br /&gt;
 while (mo) {                                              // continue as long as objects are present&lt;br /&gt;
   float distance = gst.GetDistance();                      // how far ahead the object is&lt;br /&gt;
   if (distance &amp;gt; 1000.0) break;                         // break from the loop if the distance exceeds 1km&lt;br /&gt;
   Interface.Print(&amp;quot;object found at &amp;quot; distance &amp;quot; metres&amp;quot;); // print out the results&lt;br /&gt;
   mo = gst.SearchNext();                                  // search for the next object&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
[[Class Trackside#BeginTrackSearch|Trackside.BeginTrackSearch()]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26598</id>
		<title>Class World</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26598"/>
		<updated>2020-12-28T17:21:18Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* CreateTrain */ Fix formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**World (world.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*World is a static class used to access various aspects of the Trainz environment.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;World.&#039;&#039;, for example:&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_LIGHT_SNOW,World.WEATHER_CHANGEABILITY_PERIODIC);&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera View Modes===&lt;br /&gt;
----&lt;br /&gt;
*These values can be used either to choose the current camera viewing mode through World.[[#SetCameraMode|SetCameraMode()]], or to restrict certain camera modes from being accessed through methods such as World.[[#SetCamera|SetCamera()]].&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_INTERNAL = 1||Internal cabin camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_EXTERNAL = 2||External train camera view&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_TRACKING = 4||External tracking camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_ROAMING = 128||Roaming camera view.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera Flags===&lt;br /&gt;
----&lt;br /&gt;
*These flags are used in addition to the Camera Mode Flags to allow or disallow specific camera actions. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_SWITCH_VIEWS = 8||User permitted to swap between the camera views.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_VEHICLES = 16||User permitted to swap vehicles within the current train.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_TRAINS = 32||User permitted to swap to other trains which are in the consist menu.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_LOCKED = 64||User is NOT permitted to adjust camera (i.e. zoom, pan etc.).&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_NORMAL = * ||Normal camera mode where everything is permitted.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|&amp;lt;sup&amp;gt;* NOTE: CAMERA_NORMAL = CAMERA_INTERNAL | CAMERA_EXTERNAL | CAMERA_TRACKING | CAMERA_SWITCH_VIEWS | CAMERA_SWITCH_VEHICLES | CAMERA_SWITCH_TRAINS&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the current state of the weather in Trainz. &lt;br /&gt;
*A variety of weather conditions are supported and can be changed by using one of these values with the World.[[#SetWeather|SetWeather()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_TYPE_CLEAR = 0||Clear weather, no clouds, rain or snow.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_CLOUDY = 1||Cloudy weather, no rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_DRIZZLE = 2||Drizzle, light rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_RAIN = 3||Rainy weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_STORMY = 4||Stormy weather that includes lightning and thunder.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_LIGHT_SNOW = 5||Snowing lightly.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_MEDIUM_SNOW = 6||Medium level snow fall.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_HEAVY_SNOW = 7||Heavy snow fall.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Changeability Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the changeability settings for the weather. &lt;br /&gt;
*Weather changeability refers to variability of weather conditions rather than to a specific weather type.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_CHANGEABILITY_NONE = 0||Weather remains static.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_PERIODIC = 1||Periodic changes in weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_EXTREME = 2||Extreme and frequent changes in weather. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Values===&lt;br /&gt;
----&lt;br /&gt;
*Time constants defined in seconds.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define float TIME_SECOND = 1.0f||One second.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_MINUTE = TIME_SECOND * 60.0f||One minute, 60.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_HOUR = TIME_MINUTE * 60.0f||One hour, 60.0 minutes, 3600.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_DAY = TIME_HOUR * 24.0f||One day, 24 hours, 1440.0 minutes, 86400.0 seconds.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Rate Constants===&lt;br /&gt;
----&lt;br /&gt;
*Values that define the time rates relative to normal time. &lt;br /&gt;
*These constants can be used to set the time rate that Trainz runs out through the World.[[#SetGameTimeRate|SetGameTimeRate()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  TIME_RATE_1X = 0||Real time (i.e. time in Trainz passes at the same rate as in the real world)&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_2X = 1||Time passes at twice normal speed.&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_4X = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_8X = 3||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_16X = 4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_32X = 5||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_60X = 6||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_120X = 7||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_240X = 8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_360X = 9||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_480X = 10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_720X = 11||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_960X = 12||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1200X = 13||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1440X = 14||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Layer Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*These constants can be used for querying route/session layers via [[#GetLayerList|GetLayerList]] and [[#GetLayerType|GetLayerType]].&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int LAYER_INVALID = 0||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_ROUTE = 1||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_SESSION = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_BOTH = 3||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===World Editing Mode Constants===&lt;br /&gt;
----&lt;br /&gt;
*These constants can be used to set editing modes through World.[[#SetWorldEditModeEnabled|SetWorldEditModeEnabled()]].&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int PERMIT_EDIT_NONE = 0x0||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TOPOLOGY = 0x1||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_PAINT = 0x2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_SCENERYOBJECTS = 0x4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_SCENERYSPLINES = 0x8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKSPLINES = 0x10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKSIDEOBJECTS = 0x20||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKMARKS = 0x40||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TOOLS = 0x80||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_WORLD = 0x100||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_LAYERS = 0x200||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRAINS = 0x400||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_CONSISTS = 0x800||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_ALL = -1||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Trainz Modules===&lt;br /&gt;
----&lt;br /&gt;
*Trainz module mode constants. &lt;br /&gt;
*These values define the various module environments that Trainz can be in. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  NO_MODULE = 0||Trainz not running in a module.&lt;br /&gt;
|-&lt;br /&gt;
|public define int SURVEYOR_MODULE = 1||Trainz is currently running in Surveyor.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DRIVER_MODULE = 2||Trainz is currently running in Driver.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
* [[TrainzScript Message Reference]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Camera Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Interface Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[ModuleInit Message]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]] AddDriverCharacter([[Class Asset|Asset]] driverCharacterAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCharacterAsset&#039;&#039;&#039; = Asset containing character to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCharacter if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter Casey = World.AddDriverCharacter(CaseyJones);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] AddDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.AddDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CancelCurrentEditingMode==&lt;br /&gt;
{{MethodHeader|public native void CancelCurrentEditingMode(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;
 World.CancelCurrentEditingMode();&lt;br /&gt;
;Notes&lt;br /&gt;
* Cancels out of any player entered editing mode, if relevant. This should only normally be called as a result of direct player action.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateBehavior==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]] CreateBehavior([[Class KUID|KUID]] kuid, [[Class Soup|Soup]] initialProperties)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of scenario.&lt;br /&gt;
&#039;&#039;&#039;initialProperties&#039;&#039;&#039; = Soup object containing initial properties for scenario.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the ScenarioBehavior created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior scenario = World.CreateBehavior(scenarioAsset, scenarioSoup);&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned ScenarioBehavior object may be ended by releasing all references to it (resetting all references to null).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrain==&lt;br /&gt;
{{MethodHeader|public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, string trackmarkName, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class TrackMark|TrackMark]] trackmark, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class Buildable|Buildable]] buildable, string trackName, float position, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class GSTrackSearch|GSTrackSearch]] tracksearch, bool avoidDerailments)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class GSTrackSearch|GSTrackSearch]] tracksearch)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;consist&#039;&#039;&#039; = An array of vehicle KUIDs used to describe the required Train object.&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;buildable&#039;&#039;&#039; = Buildable on which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;trackName&#039;&#039;&#039; = Name of track within Buildable object.&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; = Distance at which the Train is to be placed relative to the start of the track.&lt;br /&gt;
*&#039;&#039;&#039;trackmark&#039;&#039;&#039; = Reference to Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = Orientation of Train relative to direction of track or trackmark.&lt;br /&gt;
*&#039;&#039;&#039;tracksearch&#039;&#039;&#039; = The location at which to create the train&lt;br /&gt;
*&#039;&#039;&#039;avoidDerailments&#039;&#039;&#039; = If true this function will fail and return null if creating the train would cause a derailment&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the Train created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = World.CreateTrain(consist, buildable, &amp;quot;Track 1&amp;quot;, 10.0, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*These methods create a train from a list of vehicles in a consist array.&lt;br /&gt;
*Depending on the variant of the method used, the train can be created at a Trackmark, specified by name or reference, or at a Buildable or Industry object.&lt;br /&gt;
*It is the responsibility of the script programmer to ensure that sufficient track exists at the given location to allow the train to be created.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;&#039;&#039;&#039;GSTrackSearch&#039;&#039;&#039; aliases added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteTrain==&lt;br /&gt;
{{MethodHeader|public native void DeleteTrain([[Class Train|Train]] train)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = train to be deleted from map.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteTrain(flyingScotsman);&lt;br /&gt;
;Notes&lt;br /&gt;
*Once a train has been deleted, care should be taken to avoid using its reference.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteVehicle==&lt;br /&gt;
{{MethodHeader|public native void DeleteVehicle([[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = vehicle to be deleted from its train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteVehicle(vehicles[vehicles.size()-1]);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use [[Class Train#GetVehicles|Train.GetVehicles()]] to obtain an array of vehicles for a given train.&lt;br /&gt;
*Use [[Class Vehicle#GetMyTrain|Vehicle.GetMyTrain()]] to obtain a train reference for a given vehicle.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==EndScenario==&lt;br /&gt;
{{MethodHeader|public void EndScenario(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = Amount of seconds to delay before ending the session&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.EndScenario(30.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindAsset==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]] FindAsset([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of Asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Given a valid KUID parameter, this method return an Asset reference if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset asset = World.FindAsset(kuid);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also Asset.FindAsset()&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] FindDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.FindDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAssetList==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]][ ] GetAssetList(string kind)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kind&#039;&#039;&#039; = String representing the Kind of asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of all assets of the given &#039;&#039;kind&#039;&#039;&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset[] Libraries = World.GetAssetList(&amp;quot;Library&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*All installed assets of the given &#039;&#039;kind&#039;&#039; are returned, irrespective of whether or not they are in use on the current map.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetBadWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Bad weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetBadWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBehaviors==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]][ ] GetBehaviors(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of top-level behaviors or rules on the currently loaded route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior[] rules = World.GetBehaviors();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPitch==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPitch(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera pitch, in radians&lt;br /&gt;
;Syntax&lt;br /&gt;
 float pitch = World.GetCameraPitch();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionX==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionX(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*X Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float X = World.GetCameraPositionX();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionY==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionY(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Y Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Y = World.GetCameraPositionY();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionZ==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionZ(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Z Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Z = World.GetCameraPositionZ();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraYaw==&lt;br /&gt;
{{MethodHeader|public native float GetCameraYaw(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera yaw, in radians&lt;br /&gt;
;Syntax&lt;br /&gt;
 float yaw = World.GetCameraYaw();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraZoom==&lt;br /&gt;
{{MethodHeader|public native float GetCameraZoom(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera zoom, in meters&lt;br /&gt;
;Syntax&lt;br /&gt;
 float zoom= World.GetCameraZoom();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Is this value equivalent to &#039;&#039;&#039;radius&#039;&#039;&#039; in [[#SetCameraAngle|SetCameraAngle()]]?&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentModule==&lt;br /&gt;
{{MethodHeader|public native int GetCurrentModule(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An integer representing the current Trainz module.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int module = World.GetCurrentModule();&lt;br /&gt;
;Notes&lt;br /&gt;
* See [[#Trainz Modules|Trainz Modules]] for details of the constants associated with this method. &lt;br /&gt;
* See [[ModuleInit Message]] for further details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentProfile==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]] GetCurrentProfile(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current session asset&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset currentSession = World.GetCurrentProfile();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentTrain==&lt;br /&gt;
{{MethodHeader|public native Train GetCurrentTrain(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The currently focused train&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train myTrain = World.GetCurrentTrain();&lt;br /&gt;
;Notes&lt;br /&gt;
* The current train is the one currently controlled by the user, which may not be the train the camera is focused on.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCharacterList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]][ ] GetDriverCharacterList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCharacter objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter[] drivers = World.GetDriverCharacterList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCommandList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]][ ] GetDriverCommandList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCommand objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand[] commands = World.GetDriverCommandList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameDate==&lt;br /&gt;
{{MethodHeader|public native int GetGameDate(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game day (1 - 31)&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameDate();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameMonth==&lt;br /&gt;
{{MethodHeader|public native int GetGameMonth(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game month (1 - 12)&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameMonth();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameObjectByID==&lt;br /&gt;
{{MethodHeader|public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetGameObjectByID([[Class GameObjectID|GameObjectID]] objectID, bool bTriggerLoad)&amp;lt;br&amp;gt;public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetGameObjectByID([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the object to find.&lt;br /&gt;
*&#039;&#039;&#039;bTriggerLoad&#039;&#039;&#039; = Optional, defaults to true. Whether to trigger an asynchronous load of any matching object (if it&#039;s not loaded already).&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Asynchronous search result object. &lt;br /&gt;
;Syntax&lt;br /&gt;
 AsyncObjectSearchResult search_result = World.GetGameObjectByID(objectID, true);  // Search for and load an object&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[HowTo/Search for objects in the world]] for a detailed guide on asynchronous searches.&lt;br /&gt;
*The retured object is a reference to the in-progress object search.&lt;br /&gt;
*When the search completes, a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncResult&amp;quot; will be posted to the result object.&lt;br /&gt;
*If bTriggerLoad is true, a further message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncLoadComplete&amp;quot; will be posted when all objects are loaded into memory. This message will still be posted if every object is already loaded.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameObjectByIDIfLoaded==&lt;br /&gt;
{{MethodHeader|public native [[Class GameObject|GameObject]] GetGameObjectByIDIfLoaded([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the boject to find.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* The object, if it exists and is currently loaded.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject my_object = World.GetGameObjectByID(objectID);&lt;br /&gt;
 if (my_object Interface.Print(&amp;quot;Object exists and is loaded&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameSeason==&lt;br /&gt;
{{MethodHeader|public native float GetGameSeason(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game season&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Season = World.GetGameSeason();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = mid-summer&lt;br /&gt;
*0.5 = mid-winter&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameTime==&lt;br /&gt;
{{MethodHeader|public native float GetGameTime(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Now = World.GetGameTime();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday&lt;br /&gt;
*0.25 = 6 p.m.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*0.75 = 6 a.m.&lt;br /&gt;
*1.0 = midday again&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert the normalised values to human readable times.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameYear==&lt;br /&gt;
{{MethodHeader|public native int GetGameYear(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game year.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameYear();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetGoodWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Good weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGoodWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetGroundDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Ground draw distance in metres.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGroundDrawDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetIndustryList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class GameObject|GameObject]][ ] GetIndustryList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the Industry objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject[] Industries = World.GetIndustryList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetJunctionList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Junction|Junction]][ ] GetJunctionList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackside junction objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Junction[] junctions = World.GetJunctionList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
*Junction objects attached to fixed track junctions are not returned by this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLayerList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetLayerList(int layerType)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*layerType = LAYER_ROUTE, LAYER_SESSION, or LAYER_BOTH&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Array of layer names&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] routeLayerNames = World.GetLayerList(World.LAYER_ROUTE);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLayerType==&lt;br /&gt;
{{MethodHeader|public native int GetLayerType(string layerName)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*layerName = The name of the layer&lt;br /&gt;
;Returned Value&lt;br /&gt;
*LAYER_ROUTE or LAYER_SESSION&lt;br /&gt;
;Syntax&lt;br /&gt;
 int layerType = World.GetLayerType(&amp;quot;MyLayer&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLibrary==&lt;br /&gt;
{{MethodHeader|public native [[Class Library|Library]] GetLibrary([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of script library asset to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the script library asset if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Library codelib = World.GetLibrary(LibraryKUID);&lt;br /&gt;
;Notes&lt;br /&gt;
*The [[Class Library|Library]] asset is initialised when this method is first called in a session.&lt;br /&gt;
*Since only one instance can exist, subsequent calls return a reference to the existing Library object.&lt;br /&gt;
*See [[Class Library|Library]] for notes on how to use this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLocalPlayerName==&lt;br /&gt;
{{MethodHeader|public native string GetLocalPlayerName(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The name of the local player&lt;br /&gt;
;Syntax&lt;br /&gt;
 string playerName = World.GetLocalPlayerName();&lt;br /&gt;
;Notes&lt;br /&gt;
* Gets the name of the local player, as should be used for setting ownership on DriverCharacters, etc.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in .TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetNamedObjectList==&lt;br /&gt;
{{MethodHeader|public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetNamedObjectList(string categoryFilter, string nameFilter, bool bNotifyOfExpiry)&amp;lt;br&amp;gt;public [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetNamedObjectList(string categoryFilter, string nameFilter)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;categoryFilter&#039;&#039;&#039; = A category filter to search for. Optional, provided a nameFilter parameter is provided. A category code reference can be found in [[Class AssetCategory|AssetCategory]].&lt;br /&gt;
*&#039;&#039;&#039;nameFilter&#039;&#039;&#039; = A partial object name to search for. Optional, provided a categoryFilter parameter is provided.&lt;br /&gt;
*&#039;&#039;&#039;bNotifyOfExpiry&#039;&#039;&#039; = Optional, defaults to false. If native code detects that the search results have changed then a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;Expired&amp;quot; will be posted to the result object, and the calling script can perform a new search if desired&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Asynchronous search result object. &lt;br /&gt;
;Syntax&lt;br /&gt;
 AsyncObjectSearchResult search_result = World.GetNamedObjectList(AssetCategory.Locomotive, &amp;quot;SD40-2&amp;quot;); // Search for all SD40-2 locomotives in the world&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[HowTo/Search for objects in the world]] for a detailed guide on asynchronous searches.&lt;br /&gt;
*The retured object is a reference to the in-progress object search.&lt;br /&gt;
*When the search completes, a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncResult&amp;quot; will be posted to the result object.&lt;br /&gt;
*With expiration notices are enabled, only one notification of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;Expired&amp;quot; will be posted for each search.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetSceneryDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Undefined.&lt;br /&gt;
;Notes&lt;br /&gt;
*Included for legacy script compatibility only. Has no effect.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSeconds==&lt;br /&gt;
{{MethodHeader|public native float GetSeconds(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current value of a floating point number incrementing once per second in real time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float start = World.GetSeconds();&lt;br /&gt;
 // do stuff&lt;br /&gt;
 float finish = World.GetSeconds();&lt;br /&gt;
 float period = finish - start;&lt;br /&gt;
;Notes&lt;br /&gt;
*Each call will return a float value containing the current value of an internal counter.&lt;br /&gt;
*Subtracting a later value from a value saved at an earlier call will enable the delay between the two calls to be established.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSignalList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Signal|Signal]][ ] GetSignalList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the signal objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Signal[] signals = World.GetSignalList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStringTable==&lt;br /&gt;
{{MethodHeader|public native [[Class StringTable|StringTable]] GetStringTable(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The StringTable for the current session.&lt;br /&gt;
;Syntax&lt;br /&gt;
 StringTable data = World.GetStringTable();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsist==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Soup|Soup]] GetSurveyorSavedConsist(string name)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; = Name of the consist to retrieve.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a Soup definition of the named consist if it exists, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Soup consist = World.GetSurveyorSavedConsist(&amp;quot;Brighton Belle&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Remember that the returned data is in a Soup format, which is not the same thing as a Train. &lt;br /&gt;
*[[Class TrainUtil#CreateTrainFromSoup|TrainUtil.CreateTrainFromSoup()]] can be used to create a train from the returned Soup.&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
*Obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsistList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetSurveyorSavedConsistList()}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of names of all the saved consist objects in Surveyor.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] consists = World.GetSurveyorSavedConsistList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
*Obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTimeElapsed==&lt;br /&gt;
{{MethodHeader|public native float GetTimeElapsed(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The number of real-time seconds that have passed since the start of the current session. &lt;br /&gt;
;Syntax&lt;br /&gt;
 float secondsElapsed = World.GetTimeElapsed();&lt;br /&gt;
;Notes&lt;br /&gt;
*This measure of time stops passing while the game is paused.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrackmarkList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class TrackMark|TrackMark]][ ] GetTrackmarkList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackmark objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trackmark[] trackmarks = World.GetTrackmarkList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Train|Train]][ ] GetTrainList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trains for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train[] trains = World.GetTrainList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzBuild==&lt;br /&gt;
{{MethodHeader|public native int GetTrainzBuild(void)}}&lt;br /&gt;
;Parameters;&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Gets the current build number of Trainz. &lt;br /&gt;
;Syntax&lt;br /&gt;
 int build = World.GetTrainzBuild();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the build number you can see in the bottom-right side of the main Trainz menu screen.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzVersion==&lt;br /&gt;
{{MethodHeader|public native float GetTrainzVersion(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The TRS version number.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float version = World.GetTrainzVersion();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the version number of Content manager (for example 4.6). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTriggerList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Trigger|Trigger]][ ] GetTriggerList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trigger objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trigger[] triggers = World.GetTriggerList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
*This method does not return scenery triggers, ie those attached to SceneryWithTrack objects and their descendants.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetVehicleList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Vehicle|Vehicle]][ ] GetVehicleList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the vehicles in the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Vehicle[] vehicles = World.GetVehicleList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherChangeability==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherChangeability(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Changeability_Constants|Weather Changeability Constants]] denoting the variability of weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int variability = World.GetWeatherChangeability();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherType==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherType(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Type_Constants|Weather Type Constants]] denoting the current weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int weather = World.GetWeatherType();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsAssetRestrictionInEffect==&lt;br /&gt;
{{MethodHeader|public native bool IsAssetRestrictionInEffect(string)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether this game world has Asset Restrictions. &lt;br /&gt;
;Syntax&lt;br /&gt;
 bool assetRestrictionsExist = World.IsAssetRestrictionInEffect();&lt;br /&gt;
;Notes&lt;br /&gt;
*Multiplayer Sessions require Asset Restrictions to be in effect to avoid compatibility issues between peers.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsLayerVisible==&lt;br /&gt;
{{MethodHeader|public native bool IsLayerVisible(string layerName)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*layerName = Name of the layer to check&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether the layer is visible&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool isVisible = World.IsLayerVisible(&amp;quot;MyLayer&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadMap==&lt;br /&gt;
{{MethodHeader|public native bool LoadMap([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of map to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadMap(mapKUID) Interface.Print(&amp;quot;Map loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Map load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use World.[[#FindKUID|FindKUID()]] to find the desired route KUID.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadSession==&lt;br /&gt;
{{MethodHeader|public native bool LoadSession([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of session to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadSession(sessionKUID) Interface.Print(&amp;quot;Session loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Session load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use World.[[#FindKUID|FindKUID()]] to find the desired session KUID.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Play2DSound==&lt;br /&gt;
{{MethodHeader|public float Play2DSound([[Class Asset|Asset]] asset, string wave)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Undefined.&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;);        &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;)); &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&amp;quot; sound file from the given asset&#039;s folder.&lt;br /&gt;
*The sound is non directional and can be mono or stereo. &lt;br /&gt;
*This method does not return after the sound has finished playing, it returns with the length of the sound as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PlaySound==&lt;br /&gt;
{{MethodHeader|public native float PlaySound&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt)&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt, bool loop)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
*&#039;&#039;&#039;vol&#039;&#039;&#039; = Volume level to play the sound at (0 to 1)&amp;lt;- These values taken from TRS2019 world.gs file comments&lt;br /&gt;
*&#039;&#039;&#039;near&#039;&#039;&#039; = Distance from the target asset at which the sound will be played at maximum volume.&lt;br /&gt;
*&#039;&#039;&#039;far&#039;&#039;&#039; = Distance from the target asset at which the sound will become inaudible.&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to which the sound will be attached if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;pt&#039;&#039;&#039; = Name of attachment point in the target object if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;loop&#039;&#039;&#039; = (Optional) If true the sound will loop continuously.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Sound length in seconds for Trainz before TS12&lt;br /&gt;
* Undefined for TS12 and TANE&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1000.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&#039;&#039; sound file from the given asset&#039;s folder.&lt;br /&gt;
*If the sound is to be directional a mono sound file is required. &lt;br /&gt;
*This method does not return after the sound has finished playing: it returns as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
*If you want to wait for the sound to complete playing before moving on, wrap the PlaySound() call up in a Sleep() call. &#039;&#039;&#039;Note!&#039;&#039;&#039; This works only in Trainz versions before TS12. For newer versions, TS12 and TANE, you can hard-code the duration of the sound, or store it in the extensions container of the config.txt file.&lt;br /&gt;
*The sound volume will be at a maximum for a camera position at or less than the value of the &#039;&#039;near&#039;&#039; parameter and will reduce with distance until the hearing position reaches &#039;&#039;far&#039;&#039;, when the sound will be inaudible.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCharacter([[Class DriverCharacter|DriverCharacter]] driver)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driver&#039;&#039;&#039; = DriverCharacter to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCharacter(dave);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCommand==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCommand([[Class DriverCommand|DriverCommand]] command)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;command&#039;&#039;&#039; = DriverCommand to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCommand(driverCommand);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RestartSession==&lt;br /&gt;
{{MethodHeader|public native bool RestartSession()}}&lt;br /&gt;
;Parameters&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RestartSession();&lt;br /&gt;
;Notes&lt;br /&gt;
*Valid in Driver mode only.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetBadWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Bad weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetBadWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCamera==&lt;br /&gt;
{{MethodHeader|public native bool SetCamera([[Class MapObject|MapObject]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Junction|Junction]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Vehicle|Vehicle]] focus, int cameraMode)&amp;lt;br&amp;gt;public native void SetCamera([[Class Train|Train]] focus, int cameraMode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;focus&#039;&#039;&#039; = Object on which the camera is to be focused.&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Mode]] constants defining the view which should be assigned to the camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The first variant returns a boolean to indicate success or failure.&lt;br /&gt;
*Remaining variants do not return a value&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCamera(train.GetVehicles[0],World.CAMERA_TRACKING); // sets the camera to track the first vehicle in the train.&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Junction alias removed in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraAngle==&lt;br /&gt;
{{MethodHeader|public void SetCameraAngle(float yaw, float pitch, float radius)&amp;lt;br&amp;gt;public obsolete void SetCameraAngle(int yaw, int pitch, float radius)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;yaw&#039;&#039;&#039; = Camera rotation in radians (float) or degrees (int), 90 is a direct front view.&lt;br /&gt;
*&#039;&#039;&#039;pitch&#039;&#039;&#039; = Camera angle relative to the horizon in radians (float), or degrees (int), 0 is horizontal, 90 points vertically upwards.&lt;br /&gt;
*&#039;&#039;&#039;radius&#039;&#039;&#039; = Distance in metres to the object in focus.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraAngle(90,0,25); // Sets the camera to a direct frontal view at 25 metres from the currently focused object.&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;Radius&#039;&#039; is measured from the object origin point (0,0,0). If there&#039;s no target object this will be the distance to the ground.&lt;br /&gt;
*Note difference in units of &#039;&#039;yaw&#039;&#039; and &#039;&#039;pitch&#039;&#039; depending in the method signature used.&lt;br /&gt;
*The integer version of this method call is obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraFlags==&lt;br /&gt;
{{MethodHeader|public native void SetCameraFlags(int flags)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039;  integer value defining what the user is permitted to do with the game camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 // User is permitted to select External or Tracking views only.&lt;br /&gt;
    World.SetCameraFlags(World.CAMERA_EXTERNAL | World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use any combination of [[#Camera_Flags|Camera Flags]] and [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraMode==&lt;br /&gt;
{{MethodHeader|public void SetCameraMode(int mode)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = Camera mode to select.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraMode(World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetEditingCamera==&lt;br /&gt;
{{MethodHeader|public void SetEditingCamera([[Class GameObject|GameObject]] actor, bool bIsActorEditingCamera)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;actor&#039;&#039;&#039; = The script who is intended to edit the camera position.&lt;br /&gt;
*&#039;&#039;&#039;bIsActorEditingCamera&#039;&#039;&#039; = True to begin editing, or False to end the editing operation. &lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetEditingCamera(myScript, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*Hints to the caching systems that the camera position is in the process of being changed. This may reduce the amount of streaming that will occur until the change is complete.&lt;br /&gt;
*This is intended for use-cases where the decision to move the camera happens in advance of the actual call to [[#SetCamera|SetCamera()]] or etc., for example when the new camera target needs to be streamed in first.&lt;br /&gt;
*There is no advantage in calling this unless your code then sleeps/waits before undoing the call.&lt;br /&gt;
*It is not required to call this before using SetCamera() etc.&lt;br /&gt;
*A boolean state is stored per actor; multiple calls to enable editing on a single actor do not need to be matched to multiple calls to disable editing.&lt;br /&gt;
*It is counterproductive to call this when transitioning the camera over a short distance (ie. where the source and target locations can see each other). If jumping to a new location, followed by a visual camera transition at the new location, camera editing may be enabled around the target-selection for the jump, and the jump itself, but should be disabled before proceeding with the transition.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameDate==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(int year, int month, int date)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;year&#039;&#039;&#039; = The year to set (1970-2038)&lt;br /&gt;
*&#039;&#039;&#039;month&#039;&#039;&#039; = The month to set (1-12)&lt;br /&gt;
*&#039;&#039;&#039;day&#039;&#039;&#039; = The day to set (1-31)&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(2000, 12, 25);  // sets date to 25 December 2000&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTime==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = new gane time to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(0.5);  // sets time to midnight&lt;br /&gt;
;Notes&lt;br /&gt;
*Game time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday&lt;br /&gt;
*0.25 = 6 p.m.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*0.75 = 6 a.m.&lt;br /&gt;
*1.0 = midday again&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert human readable times to normalised values. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTimeRate==&lt;br /&gt;
{{MethodHeader|public native void SetGameTimeRate(float rate)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;rate&#039;&#039;&#039; = New time rate to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTimeRate(World.TIME_RATE_8X); // sets game time to advance by 8 minutes per minute of real world time.&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Time_Rate_Constants|Time Rate Constants]] to define the parameter.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetGoodWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Good weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGoodWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetGroundDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Ground draw distance in metres.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGroundDrawDistance(1000.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Compatibility warning: Use of this function is not recommended, it may become non-functional in future Trainz versions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetLayerVisible==&lt;br /&gt;
{{MethodHeader|public native void IsLayerVisible(string layerName, bool visible)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*layerName = Name of the layer to check&lt;br /&gt;
*visible = Whether to set the layer visible or not&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.IsLayerVisible(&amp;quot;MyLayer&amp;quot;, False);&lt;br /&gt;
;Notes&lt;br /&gt;
*Show/Hide a route/session layer.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetSceneryDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = unused.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
* Does nothing. Included for script compatibility only.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetTargetObserver==&lt;br /&gt;
{{MethodHeader|public void SetTargetObserver([[Class GameObject|GameObject]] observer)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;observer&#039;&#039;&#039; = The game object to receive targeting messages.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SetTargetObserver(self);&lt;br /&gt;
;Notes&lt;br /&gt;
* It is unlikely a script programmer would ever need to use this method.&lt;br /&gt;
* Causes the specified object to receive &amp;quot;Track&amp;quot;, &amp;quot;LeftClick&amp;quot; messages when a track is clicked. Causes the specified object to receive &amp;quot;Interface-Event&amp;quot;, &amp;quot;Left-Click&amp;quot; messages when a targetable MapObject is clicked. May cause the functionality of a left mouse click to change from what the user is expecting, so should be used with caution. Used in modal scripts to allow the user to indicate a location for train placement, etc. As there is only a single observer at any given time, the script must take care to only call this function when entering placement mode at the user&#039;s request.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWeather==&lt;br /&gt;
{{MethodHeader|public native void SetWeather(int type, int changeability)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;type&#039;&#039;&#039; = Weather conditions as defined by one of the [[#Weather_Type_Constants|Weather Type Constants]].&lt;br /&gt;
*&#039;&#039;&#039;change&#039;&#039;&#039; = Weather variation as defined by one of the [[#Weather_Changeability_Constants|Weather Changeability Constants]].&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_HEAVY_SNOW,World.WEATHER_CHANGEABILITY_EXTREME); // April in Paris.&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWorldEditModeEnabled==&lt;br /&gt;
{{MethodHeader|public native bool SetWorldEditModeEnabled(int editFlags, bool enable)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;editFlags&#039;&#039;&#039; = Bitmask specifying which modes to alter, see PERMIT_EDIT_*&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = Whether to enable or disable the mode&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether the change was completely successful&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWorldEditModeEnabled(World.PERMIT_EDIT_TRAINS | World.PERMIT_EDIT_CONSISTS, True); // Enable player editing of trains and consists&lt;br /&gt;
;Notes&lt;br /&gt;
*This does not affect scripts which may alter the world, only the availability of the player world editing tools (i.e, the Surveyor tabs).&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SynchronouslyLoadGameObjectByID==&lt;br /&gt;
{{MethodHeader|public [[Class GameObject|GameObject]] SynchronouslyLoadGameObjectByID([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the object to find.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* The object, if it exists.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject my_object = World.SynchronouslyLoadGameObjectByID(objectID);&lt;br /&gt;
 if (my_object Interface.Print(&amp;quot;Object exists and has been loaded if required&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is usable only by script &#039;thread&#039; functions and will throw an exception if called incorrectly.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UpdatePositionToGroundHeight==&lt;br /&gt;
{{MethodHeader|public native bool UpdatePositionToGroundHeight([[Class WorldCoordinate|WorldCoordinate]] position)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; (in, out) = Position object to update with the ground height at it&#039;s location&lt;br /&gt;
;Returned Value&lt;br /&gt;
* True if the ground position was updated&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.UpdatePositionToGroundHeight(position) Interface.Print(&amp;quot;Position was updated&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This updates the input &#039;&#039;position&#039;&#039; object with the ground height at that location.&lt;br /&gt;
*This process may fail if the ground data at the specified location is not currently loaded.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UpdatePositionToSurfaceHeight==&lt;br /&gt;
{{MethodHeader|public native bool UpdatePositionToSurfaceHeight([[Class WorldCoordinate|WorldCoordinate]] position)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; (in, out) = Position object to update with the water height at it&#039;s location&lt;br /&gt;
;Returned Value&lt;br /&gt;
* True if the ground position was updated&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.UpdatePositionToGroundHeight(position) Interface.Print(&amp;quot;Position was updated&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This updates the input &#039;&#039;position&#039;&#039; object with the water height at that location. If no water is present, the position is adjusted to the ground height.&lt;br /&gt;
*This process may fail if the ground data at the specified location is not currently loaded.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCamera==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera([[Class GameObject|GameObject]] target)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to set focus to.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraMode==&lt;br /&gt;
{{MethodHeader|public native void UserSetCameraMode(int mode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Modes]]&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCameraMode(World.CAMERA_ROAMING);  // switches to roaming view if permitted.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method respects the current [[#Camera_Flags|Camera Flag]] settings, disallowing any change which the flags do not permit.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraPosition==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera([[Class WorldCoordinate|WorldCoordinate]] camPos)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;camPos&#039;&#039;&#039; = World coordinates to set camera to&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
* For camera modes which do not need to target specific objects, this allows the camera to be set to an arbitrary world position.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26597</id>
		<title>Class TrainUtil</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26597"/>
		<updated>2020-12-28T17:20:50Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* CreateTrainFromSoup */ Note existence of World.CreateTrain&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**TrainUtil&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*TrainUtil is a static utility class containing a miscellany of methods.&lt;br /&gt;
*TrainUtil is located in &#039;&#039;&#039;common.gs&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AlreadyThereStr==&lt;br /&gt;
{{MethodHeader|public bool AlreadyThereStr(string[ ] target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Array of strings to search.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Boolean indicating whether or not the string &#039;&#039;search&#039;&#039; exists in the &#039;&#039;target&#039;&#039; array.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] target = Str.Tokens(&amp;quot;one two three&amp;quot;);&lt;br /&gt;
 bool found = TrainUtil.AlreadyThereStr(target,&amp;quot;four&amp;quot;);    // the result will be false&lt;br /&gt;
;Notes&lt;br /&gt;
*As is usual in Trainzscript string methods the search is case sensitive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreInTrain==&lt;br /&gt;
{{MethodHeader|public bool AreInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]][ ] vehicles)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train to search.&lt;br /&gt;
*&#039;&#039;&#039;vehicles&#039;&#039;&#039; = Array of vehicle to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if all of the vehicles in the array are found in the train, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool allPresent = TrainUtil.AreInTrain(train,vehicles);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#IsInTrain|IsInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CompareStrLists==&lt;br /&gt;
{{MethodHeader|public bool CompareStrLists(string[ ] list1, string[ ] list2)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;list1,list2&#039;&#039;&#039; = String arrays.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the lists are identical, same strings in each index position, same total count. False otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool identical = TrainUtil.CompareStrLists(address1,address2);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrainFromSoup==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] CreateTrainFromSoup([[Class Soup|Soup]] trainSoup, string trackmarkName, bool direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;trainSoup&#039;&#039;&#039; = Consist definition in the form returned by [[Class World#GetSurveyorSavedConsist|World.GetSurveyorSavedConsist()]].&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of the trackmark where the train is to be placed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = True denotes that the train direction should match that of the trackmark.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly created train if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = TrainUtil.CreateTrainFromSoup(BrightonBelle,&amp;quot;Victoria Station&amp;quot;,true);&lt;br /&gt;
;Notes&lt;br /&gt;
*It is the script programmer&#039;s responibility to ensure that sufficient track exists.&lt;br /&gt;
*See also [[Class World#CreateTrain|World.CreateTrain()]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoCoupleUp==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoCoupleUp([[Class Train|Train]] train, [[Class Train|Train]] coupleTo)}}&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = First train.&lt;br /&gt;
*&#039;&#039;&#039;coupleTo&#039;&#039;&#039; = Train to couple with.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly extended train.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train newTrain = TrainUtil.DoCoupleUp(train, newSection);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoDecouple==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoDecouple([[Class Train|Train]] train, int count)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;count&#039;&#039;&#039; = Number of wagons to detach from the rear of the train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the remaining consist (front section) if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 train = TrainUtil.DoDecouple(train,4);  // drop four cars from the rear of the train, &#039;&#039;train&#039;&#039; will be null if this fails.&lt;br /&gt;
;Notes&lt;br /&gt;
*It is assumed that the train is stopped and already in position.&lt;br /&gt;
*The method will wait for the operation to be completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAfter==&lt;br /&gt;
{{MethodHeader|public string GetAfter(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the right of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetAfter(&amp;quot;Afternoon&amp;quot;, &amp;quot;er&amp;quot;);   // result is &amp;quot;noon&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the end of the string and works backwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring after that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetUpTo==&lt;br /&gt;
{{MethodHeader|public string GetUpTo(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the left of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetUpTo(&amp;quot;Before noon&amp;quot;,&amp;quot; no&amp;quot;);   // result is &amp;quot;Before&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the beginning of the string and works forwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring before that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasPrefix==&lt;br /&gt;
{{MethodHeader|public bool HasPrefix(string target, string prefix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;prefix&#039;&#039;&#039; = String containing prefix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; starts with &#039;&#039;prefix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsPrefixed = TrainUtil.HasPrefix(&amp;quot;ante&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasSufix==&lt;br /&gt;
{{MethodHeader|public bool HasSufix(string target, string suffix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;suffix&#039;&#039;&#039; = String containing suffix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; ends with &#039;&#039;suffix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsSuffixed = TrainUtil.HasSufix(&amp;quot;dent&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
*This will not work if the method identifier is correctly spelled!&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsInTrain==&lt;br /&gt;
{{MethodHeader|public bool IsInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = Vehicle reference.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;vehicle&#039;&#039; is included in &#039;&#039;train&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool brakeVanPresent = TrainUtil.IsInTrain(train,brakeVan); &lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#AreInTrain|AreInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPartTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsPartTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if any part of the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsPartTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RandBool==&lt;br /&gt;
{{MethodHeader|public bool RandBool(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True or false at random.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if(TrainUtil.RandBool()) DoItAtRandom();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RunTurnTable==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void RunTurnTable([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, string turntable)}}&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;turntable&#039;&#039;&#039; = Name of turntable.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 TrainUtil.RunTurnTable(me,train,&amp;quot;Turntabel 1&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;???????&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==StrSubst==&lt;br /&gt;
{{MethodHeader|public string StrSubst(string target, string remove, string replace)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;remove&#039;&#039;&#039; = Substring to remove.&lt;br /&gt;
*&#039;&#039;&#039;replace&#039;&#039;&#039; = Replacement substring.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns the string target with &#039;&#039;replace&#039;&#039; substituted for &#039;&#039;remove&#039;&#039;, if the method fails an empty string is returned.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string s = &amp;quot;Gnomes are your friends&amp;quot;;&lt;br /&gt;
 s = TrainUtil.StrSubst(s,&amp;quot;friends&amp;quot;,&amp;quot;enemies&amp;quot;);    // returns &amp;quot;Gnomes are your enemies&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; must exist as a substring of &#039;&#039;target&#039;&#039;, otherwise and empty string will be returned.&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; and &#039;&#039;replace&#039;&#039; do not have to be the same length.&lt;br /&gt;
*Only the first instance of &#039;&#039;remove&#039;&#039; will be substituted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WaitUntilHas==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void WaitUntilHas([[Class Vehicle|Vehicle]] loco, ShuntTrack tracking)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;loco&#039;&#039;&#039; = Consist locomotive.&lt;br /&gt;
*&#039;&#039;&#039;tracking&#039;&#039;&#039; = Tracking array.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
*Waits until all of the vehicles tracked by the tracking array are in the train of the given loco.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26596</id>
		<title>TrainzScript Library Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26596"/>
		<updated>2020-12-28T17:19:34Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Note location of Trainz script source code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a list of all classes provided by Auran for use with the Trainz game runtime environment. Some of these classes may not be available from other runtime environments. Please see the [[TrainzScript Language Reference]] for a list of the &amp;quot;core&amp;quot; TrainzScript classes that are present in all runtime environments. This list may not be complete, but will be extended in future.&lt;br /&gt;
&lt;br /&gt;
The source code for all classes can be found within your Trainz installation, under &#039;&#039;resources/scripts&#039;&#039;. Most classes are contained within obviously named files - e.g. the [[Class World|World]] class can be found in &#039;&#039;world.gs&#039;&#039; - although not all classes are in separate files - [[Class TrainUtil|TrainUtil]] is located in &#039;&#039;common.gs&#039;&#039;. Thorough documentation of classes, methods, and constants exists within the source code.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Classes marked with an asterisk have no parent class.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*[[class AssetCategory|AssetCategory]] *&lt;br /&gt;
*[[class GSObject|GSObject]] *&lt;br /&gt;
**[[class Asset|Asset]]&lt;br /&gt;
**[[class DLCInfo|DLCInfo]]&lt;br /&gt;
**[[class GameObjectID|GameObjectID]]&lt;br /&gt;
**[[class GameObject|GameObject]]&lt;br /&gt;
***[[class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
***[[class AsyncTrainzAssetSearchObject|AsyncTrainzAssetSearchObject]]&lt;br /&gt;
***[[class Browser|Browser]]&lt;br /&gt;
***[[class BrowserInterface|BrowserInterface]]&lt;br /&gt;
***[[class CabinControl|CabinControl]]&lt;br /&gt;
***[[class ConstructorsBase|ConstructorsBase]]&lt;br /&gt;
****[[class Constructors|Constructors]]&lt;br /&gt;
***[[class DLCStore|DLCStore]]&lt;br /&gt;
***[[class DriverCommand|DriverCommand]]&lt;br /&gt;
***[[class DriverCommands|DriverCommands]]&lt;br /&gt;
***[[class HTMLPropertyHandler|HTMLProprtyHandler]]&lt;br /&gt;
***[[class Interface|Interface]]&lt;br /&gt;
***[[class InterlockingTowerPath|InterlockingTowerPath]]&lt;br /&gt;
***[[class JunctionBaseGameObject|JunctionBaseGameObject]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
***[[class NavPoints|NavPoints]]&lt;br /&gt;
***[[class ChatChannel|ChatChannel]]&lt;br /&gt;
***[[class OnlineAccess|OnlineAccess]]&lt;br /&gt;
***[[class OnlineGroup|OnlineGroup]]&lt;br /&gt;
***[[class Track|Track]]&lt;br /&gt;
***[[class TrackCircuitBlock|TrackCircuitBlock]]&lt;br /&gt;
***[[class Train|Train]]&lt;br /&gt;
***[[class TrainzAssetSearch|TrainzAssetSearch]]&lt;br /&gt;
***[[class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[class GameplayMenuBase|GameplayMenuBase]]&lt;br /&gt;
*****[[class GameplayMenu|GameplayMenu]]&lt;br /&gt;
*****[[class GameplayMenuMobile|GameplayMenuMobile]]&lt;br /&gt;
****[[class Library|Library]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class OAChat|OAChat]]&lt;br /&gt;
*****[[class Servlet|Servlet]]&lt;br /&gt;
*****[[class SessionVariables|SessionVariables]]&lt;br /&gt;
*****[[class WaybillManager|WaybillManager]]&lt;br /&gt;
****[[class MeshObject|MeshObject]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class Bogey|Bogey]]&lt;br /&gt;
*****[[class Cabin|Cabin]]&lt;br /&gt;
*****[[class MapObject|MapObject]]&lt;br /&gt;
******[[class InterlockingTower|InterlockingTower]]&lt;br /&gt;
******[[class SceneryWithTrack|SceneryWithTrack]]&lt;br /&gt;
*******[[class Buildable|Buildable]]&lt;br /&gt;
********[[class Industry|Industry]]&lt;br /&gt;
*********[[class BaseIndustry|BaseIndustry]]&lt;br /&gt;
**********[[class GenericPassengerStation|GenericPassengerStation]]&lt;br /&gt;
*********[[class BasePortal|BasePortal]]&lt;br /&gt;
*********[[class GenericIndustry|GenericIndustry]]&lt;br /&gt;
*******[[class Crossing|Crossing]]&lt;br /&gt;
*******[[Class_Turntable|TurnTable]]&lt;br /&gt;
******[[class Trackside|Trackside]]&lt;br /&gt;
*******[[class CarSignal|CarSignal]]&lt;br /&gt;
*******[[class Junction|Junction]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
*******[[class Signal|Signal]]&lt;br /&gt;
*******[[class TrackMark|TrackMark]]&lt;br /&gt;
*******[[class Trigger|Trigger]]&lt;br /&gt;
*******[[class Vehicle|Vehicle]]&lt;br /&gt;
********[[class Locomotive|Locomotive]]&lt;br /&gt;
****[[class ModulScript|ModulScript]]&lt;br /&gt;
*****[[class DriverCharacter|DriverCharacter]]&lt;br /&gt;
****[[class ScenarioBehavior|ScenarioBehavior]]&lt;br /&gt;
*****[[class ConditionalScenarioBehavior|ConditionalScenarioBehavior]]&lt;br /&gt;
*****[[class ScenarioBehaviorTemplate|ScenarioBehaviorTemplate]]&lt;br /&gt;
***[[class TrainzScriptBase|TrainzScriptBase]]&lt;br /&gt;
****[[class World|World]]&lt;br /&gt;
***[[class World1|World1]]&lt;br /&gt;
**[[class HTMLBuffer|HTMLBuffer]]&lt;br /&gt;
**[[class IndustryTrainController|IndustryTrainController]]&lt;br /&gt;
**[[class KUID|KUID]]&lt;br /&gt;
**[[class KUIDList|KUIDList]]&lt;br /&gt;
**[[class LoadingReport|LoadingReport]]&lt;br /&gt;
**[[class Menu|Menu]]&lt;br /&gt;
**[[class Permit|Permit]]&lt;br /&gt;
**[[class ProductFilter|ProductFilter]]&lt;br /&gt;
**[[class ProductQueue|ProductQueue]]&lt;br /&gt;
**[[class SecurityToken|SecurityToken]]&lt;br /&gt;
**[[class Soup|Soup]]&lt;br /&gt;
**[[class StringTable|StringTable]]&lt;br /&gt;
**[[class TrackPathDisplay|TrackPathDisplay]]&lt;br /&gt;
**[[class TrainTimeTable|TrainTimeTable]]&lt;br /&gt;
*[[class GSTrackSearch|GSTrackSearch]] *&lt;br /&gt;
*[[class Math|Math]] *&lt;br /&gt;
*[[class Router|Router]] *&lt;br /&gt;
*[[class Str|Str]] *&lt;br /&gt;
*[[class TrainUtil|TrainUtil]] *&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26595</id>
		<title>Class TrainUtil</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26595"/>
		<updated>2020-12-28T17:13:31Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Change link to library reference, not language reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**TrainUtil&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*TrainUtil is a static utility class containing a miscellany of methods.&lt;br /&gt;
*TrainUtil is located in &#039;&#039;&#039;common.gs&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AlreadyThereStr==&lt;br /&gt;
{{MethodHeader|public bool AlreadyThereStr(string[ ] target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Array of strings to search.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Boolean indicating whether or not the string &#039;&#039;search&#039;&#039; exists in the &#039;&#039;target&#039;&#039; array.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] target = Str.Tokens(&amp;quot;one two three&amp;quot;);&lt;br /&gt;
 bool found = TrainUtil.AlreadyThereStr(target,&amp;quot;four&amp;quot;);    // the result will be false&lt;br /&gt;
;Notes&lt;br /&gt;
*As is usual in Trainzscript string methods the search is case sensitive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreInTrain==&lt;br /&gt;
{{MethodHeader|public bool AreInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]][ ] vehicles)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train to search.&lt;br /&gt;
*&#039;&#039;&#039;vehicles&#039;&#039;&#039; = Array of vehicle to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if all of the vehicles in the array are found in the train, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool allPresent = TrainUtil.AreInTrain(train,vehicles);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#IsInTrain|IsInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CompareStrLists==&lt;br /&gt;
{{MethodHeader|public bool CompareStrLists(string[ ] list1, string[ ] list2)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;list1,list2&#039;&#039;&#039; = String arrays.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the lists are identical, same strings in each index position, same total count. False otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool identical = TrainUtil.CompareStrLists(address1,address2);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrainFromSoup==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] CreateTrainFromSoup([[Class Soup|Soup]] trainSoup, string trackmarkName, bool direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;trainSoup&#039;&#039;&#039; = Consist definition in the form returned by [[Class World#GetSurveyorSavedConsist|World.GetSurveyorSavedConsist()]].&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of the trackmark where the train is to be placed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = True denotes that the train direction should match that of the trackmark.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly created train if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = TrainUtil.CreateTrainFromSoup(BrightonBelle,&amp;quot;Victoria Station&amp;quot;,true);&lt;br /&gt;
;Notes&lt;br /&gt;
*It is the script programmer&#039;s responibility to ensure that sufficient track exists.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoCoupleUp==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoCoupleUp([[Class Train|Train]] train, [[Class Train|Train]] coupleTo)}}&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = First train.&lt;br /&gt;
*&#039;&#039;&#039;coupleTo&#039;&#039;&#039; = Train to couple with.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly extended train.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train newTrain = TrainUtil.DoCoupleUp(train, newSection);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoDecouple==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoDecouple([[Class Train|Train]] train, int count)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;count&#039;&#039;&#039; = Number of wagons to detach from the rear of the train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the remaining consist (front section) if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 train = TrainUtil.DoDecouple(train,4);  // drop four cars from the rear of the train, &#039;&#039;train&#039;&#039; will be null if this fails.&lt;br /&gt;
;Notes&lt;br /&gt;
*It is assumed that the train is stopped and already in position.&lt;br /&gt;
*The method will wait for the operation to be completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAfter==&lt;br /&gt;
{{MethodHeader|public string GetAfter(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the right of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetAfter(&amp;quot;Afternoon&amp;quot;, &amp;quot;er&amp;quot;);   // result is &amp;quot;noon&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the end of the string and works backwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring after that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetUpTo==&lt;br /&gt;
{{MethodHeader|public string GetUpTo(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the left of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetUpTo(&amp;quot;Before noon&amp;quot;,&amp;quot; no&amp;quot;);   // result is &amp;quot;Before&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the beginning of the string and works forwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring before that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasPrefix==&lt;br /&gt;
{{MethodHeader|public bool HasPrefix(string target, string prefix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;prefix&#039;&#039;&#039; = String containing prefix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; starts with &#039;&#039;prefix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsPrefixed = TrainUtil.HasPrefix(&amp;quot;ante&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasSufix==&lt;br /&gt;
{{MethodHeader|public bool HasSufix(string target, string suffix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;suffix&#039;&#039;&#039; = String containing suffix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; ends with &#039;&#039;suffix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsSuffixed = TrainUtil.HasSufix(&amp;quot;dent&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
*This will not work if the method identifier is correctly spelled!&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsInTrain==&lt;br /&gt;
{{MethodHeader|public bool IsInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = Vehicle reference.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;vehicle&#039;&#039; is included in &#039;&#039;train&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool brakeVanPresent = TrainUtil.IsInTrain(train,brakeVan); &lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#AreInTrain|AreInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPartTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsPartTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if any part of the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsPartTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RandBool==&lt;br /&gt;
{{MethodHeader|public bool RandBool(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True or false at random.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if(TrainUtil.RandBool()) DoItAtRandom();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RunTurnTable==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void RunTurnTable([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, string turntable)}}&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;turntable&#039;&#039;&#039; = Name of turntable.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 TrainUtil.RunTurnTable(me,train,&amp;quot;Turntabel 1&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;???????&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==StrSubst==&lt;br /&gt;
{{MethodHeader|public string StrSubst(string target, string remove, string replace)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;remove&#039;&#039;&#039; = Substring to remove.&lt;br /&gt;
*&#039;&#039;&#039;replace&#039;&#039;&#039; = Replacement substring.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns the string target with &#039;&#039;replace&#039;&#039; substituted for &#039;&#039;remove&#039;&#039;, if the method fails an empty string is returned.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string s = &amp;quot;Gnomes are your friends&amp;quot;;&lt;br /&gt;
 s = TrainUtil.StrSubst(s,&amp;quot;friends&amp;quot;,&amp;quot;enemies&amp;quot;);    // returns &amp;quot;Gnomes are your enemies&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; must exist as a substring of &#039;&#039;target&#039;&#039;, otherwise and empty string will be returned.&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; and &#039;&#039;replace&#039;&#039; do not have to be the same length.&lt;br /&gt;
*Only the first instance of &#039;&#039;remove&#039;&#039; will be substituted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WaitUntilHas==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void WaitUntilHas([[Class Vehicle|Vehicle]] loco, ShuntTrack tracking)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;loco&#039;&#039;&#039; = Consist locomotive.&lt;br /&gt;
*&#039;&#039;&#039;tracking&#039;&#039;&#039; = Tracking array.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
*Waits until all of the vehicles tracked by the tracking array are in the train of the given loco.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26594</id>
		<title>Class TrainUtil</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26594"/>
		<updated>2020-12-28T17:12:37Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Note where TrainUtil class is defined&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Language Reference|API Hierarchy]]&lt;br /&gt;
**TrainUtil&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*TrainUtil is a static utility class containing a miscellany of methods.&lt;br /&gt;
*TrainUtil is located in &#039;&#039;&#039;common.gs&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AlreadyThereStr==&lt;br /&gt;
{{MethodHeader|public bool AlreadyThereStr(string[ ] target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Array of strings to search.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Boolean indicating whether or not the string &#039;&#039;search&#039;&#039; exists in the &#039;&#039;target&#039;&#039; array.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] target = Str.Tokens(&amp;quot;one two three&amp;quot;);&lt;br /&gt;
 bool found = TrainUtil.AlreadyThereStr(target,&amp;quot;four&amp;quot;);    // the result will be false&lt;br /&gt;
;Notes&lt;br /&gt;
*As is usual in Trainzscript string methods the search is case sensitive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreInTrain==&lt;br /&gt;
{{MethodHeader|public bool AreInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]][ ] vehicles)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train to search.&lt;br /&gt;
*&#039;&#039;&#039;vehicles&#039;&#039;&#039; = Array of vehicle to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if all of the vehicles in the array are found in the train, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool allPresent = TrainUtil.AreInTrain(train,vehicles);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#IsInTrain|IsInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CompareStrLists==&lt;br /&gt;
{{MethodHeader|public bool CompareStrLists(string[ ] list1, string[ ] list2)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;list1,list2&#039;&#039;&#039; = String arrays.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the lists are identical, same strings in each index position, same total count. False otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool identical = TrainUtil.CompareStrLists(address1,address2);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrainFromSoup==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] CreateTrainFromSoup([[Class Soup|Soup]] trainSoup, string trackmarkName, bool direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;trainSoup&#039;&#039;&#039; = Consist definition in the form returned by [[Class World#GetSurveyorSavedConsist|World.GetSurveyorSavedConsist()]].&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of the trackmark where the train is to be placed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = True denotes that the train direction should match that of the trackmark.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly created train if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = TrainUtil.CreateTrainFromSoup(BrightonBelle,&amp;quot;Victoria Station&amp;quot;,true);&lt;br /&gt;
;Notes&lt;br /&gt;
*It is the script programmer&#039;s responibility to ensure that sufficient track exists.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoCoupleUp==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoCoupleUp([[Class Train|Train]] train, [[Class Train|Train]] coupleTo)}}&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = First train.&lt;br /&gt;
*&#039;&#039;&#039;coupleTo&#039;&#039;&#039; = Train to couple with.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly extended train.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train newTrain = TrainUtil.DoCoupleUp(train, newSection);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoDecouple==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoDecouple([[Class Train|Train]] train, int count)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;count&#039;&#039;&#039; = Number of wagons to detach from the rear of the train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the remaining consist (front section) if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 train = TrainUtil.DoDecouple(train,4);  // drop four cars from the rear of the train, &#039;&#039;train&#039;&#039; will be null if this fails.&lt;br /&gt;
;Notes&lt;br /&gt;
*It is assumed that the train is stopped and already in position.&lt;br /&gt;
*The method will wait for the operation to be completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAfter==&lt;br /&gt;
{{MethodHeader|public string GetAfter(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the right of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetAfter(&amp;quot;Afternoon&amp;quot;, &amp;quot;er&amp;quot;);   // result is &amp;quot;noon&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the end of the string and works backwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring after that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetUpTo==&lt;br /&gt;
{{MethodHeader|public string GetUpTo(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the left of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetUpTo(&amp;quot;Before noon&amp;quot;,&amp;quot; no&amp;quot;);   // result is &amp;quot;Before&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the beginning of the string and works forwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring before that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasPrefix==&lt;br /&gt;
{{MethodHeader|public bool HasPrefix(string target, string prefix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;prefix&#039;&#039;&#039; = String containing prefix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; starts with &#039;&#039;prefix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsPrefixed = TrainUtil.HasPrefix(&amp;quot;ante&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasSufix==&lt;br /&gt;
{{MethodHeader|public bool HasSufix(string target, string suffix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;suffix&#039;&#039;&#039; = String containing suffix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; ends with &#039;&#039;suffix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsSuffixed = TrainUtil.HasSufix(&amp;quot;dent&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
*This will not work if the method identifier is correctly spelled!&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsInTrain==&lt;br /&gt;
{{MethodHeader|public bool IsInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = Vehicle reference.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;vehicle&#039;&#039; is included in &#039;&#039;train&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool brakeVanPresent = TrainUtil.IsInTrain(train,brakeVan); &lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#AreInTrain|AreInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPartTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsPartTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if any part of the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsPartTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RandBool==&lt;br /&gt;
{{MethodHeader|public bool RandBool(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True or false at random.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if(TrainUtil.RandBool()) DoItAtRandom();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RunTurnTable==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void RunTurnTable([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, string turntable)}}&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;turntable&#039;&#039;&#039; = Name of turntable.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 TrainUtil.RunTurnTable(me,train,&amp;quot;Turntabel 1&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;???????&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==StrSubst==&lt;br /&gt;
{{MethodHeader|public string StrSubst(string target, string remove, string replace)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;remove&#039;&#039;&#039; = Substring to remove.&lt;br /&gt;
*&#039;&#039;&#039;replace&#039;&#039;&#039; = Replacement substring.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns the string target with &#039;&#039;replace&#039;&#039; substituted for &#039;&#039;remove&#039;&#039;, if the method fails an empty string is returned.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string s = &amp;quot;Gnomes are your friends&amp;quot;;&lt;br /&gt;
 s = TrainUtil.StrSubst(s,&amp;quot;friends&amp;quot;,&amp;quot;enemies&amp;quot;);    // returns &amp;quot;Gnomes are your enemies&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; must exist as a substring of &#039;&#039;target&#039;&#039;, otherwise and empty string will be returned.&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; and &#039;&#039;replace&#039;&#039; do not have to be the same length.&lt;br /&gt;
*Only the first instance of &#039;&#039;remove&#039;&#039; will be substituted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WaitUntilHas==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void WaitUntilHas([[Class Vehicle|Vehicle]] loco, ShuntTrack tracking)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;loco&#039;&#039;&#039; = Consist locomotive.&lt;br /&gt;
*&#039;&#039;&#039;tracking&#039;&#039;&#039; = Tracking array.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
*Waits until all of the vehicles tracked by the tracking array are in the train of the given loco.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26593</id>
		<title>Class World</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26593"/>
		<updated>2020-12-28T17:09:09Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* GetSurveyorSavedConsist */ Add link to TrainUtil&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**World (world.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*World is a static class used to access various aspects of the Trainz environment.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;World.&#039;&#039;, for example:&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_LIGHT_SNOW,World.WEATHER_CHANGEABILITY_PERIODIC);&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera View Modes===&lt;br /&gt;
----&lt;br /&gt;
*These values can be used either to choose the current camera viewing mode through World.[[#SetCameraMode|SetCameraMode()]], or to restrict certain camera modes from being accessed through methods such as World.[[#SetCamera|SetCamera()]].&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_INTERNAL = 1||Internal cabin camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_EXTERNAL = 2||External train camera view&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_TRACKING = 4||External tracking camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_ROAMING = 128||Roaming camera view.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera Flags===&lt;br /&gt;
----&lt;br /&gt;
*These flags are used in addition to the Camera Mode Flags to allow or disallow specific camera actions. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_SWITCH_VIEWS = 8||User permitted to swap between the camera views.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_VEHICLES = 16||User permitted to swap vehicles within the current train.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_TRAINS = 32||User permitted to swap to other trains which are in the consist menu.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_LOCKED = 64||User is NOT permitted to adjust camera (i.e. zoom, pan etc.).&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_NORMAL = * ||Normal camera mode where everything is permitted.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|&amp;lt;sup&amp;gt;* NOTE: CAMERA_NORMAL = CAMERA_INTERNAL | CAMERA_EXTERNAL | CAMERA_TRACKING | CAMERA_SWITCH_VIEWS | CAMERA_SWITCH_VEHICLES | CAMERA_SWITCH_TRAINS&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the current state of the weather in Trainz. &lt;br /&gt;
*A variety of weather conditions are supported and can be changed by using one of these values with the World.[[#SetWeather|SetWeather()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_TYPE_CLEAR = 0||Clear weather, no clouds, rain or snow.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_CLOUDY = 1||Cloudy weather, no rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_DRIZZLE = 2||Drizzle, light rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_RAIN = 3||Rainy weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_STORMY = 4||Stormy weather that includes lightning and thunder.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_LIGHT_SNOW = 5||Snowing lightly.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_MEDIUM_SNOW = 6||Medium level snow fall.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_HEAVY_SNOW = 7||Heavy snow fall.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Changeability Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the changeability settings for the weather. &lt;br /&gt;
*Weather changeability refers to variability of weather conditions rather than to a specific weather type.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_CHANGEABILITY_NONE = 0||Weather remains static.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_PERIODIC = 1||Periodic changes in weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_EXTREME = 2||Extreme and frequent changes in weather. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Values===&lt;br /&gt;
----&lt;br /&gt;
*Time constants defined in seconds.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define float TIME_SECOND = 1.0f||One second.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_MINUTE = TIME_SECOND * 60.0f||One minute, 60.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_HOUR = TIME_MINUTE * 60.0f||One hour, 60.0 minutes, 3600.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_DAY = TIME_HOUR * 24.0f||One day, 24 hours, 1440.0 minutes, 86400.0 seconds.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Rate Constants===&lt;br /&gt;
----&lt;br /&gt;
*Values that define the time rates relative to normal time. &lt;br /&gt;
*These constants can be used to set the time rate that Trainz runs out through the World.[[#SetGameTimeRate|SetGameTimeRate()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  TIME_RATE_1X = 0||Real time (i.e. time in Trainz passes at the same rate as in the real world)&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_2X = 1||Time passes at twice normal speed.&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_4X = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_8X = 3||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_16X = 4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_32X = 5||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_60X = 6||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_120X = 7||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_240X = 8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_360X = 9||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_480X = 10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_720X = 11||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_960X = 12||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1200X = 13||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1440X = 14||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Layer Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*These constants can be used for querying route/session layers via [[#GetLayerList|GetLayerList]] and [[#GetLayerType|GetLayerType]].&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int LAYER_INVALID = 0||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_ROUTE = 1||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_SESSION = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_BOTH = 3||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===World Editing Mode Constants===&lt;br /&gt;
----&lt;br /&gt;
*These constants can be used to set editing modes through World.[[#SetWorldEditModeEnabled|SetWorldEditModeEnabled()]].&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int PERMIT_EDIT_NONE = 0x0||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TOPOLOGY = 0x1||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_PAINT = 0x2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_SCENERYOBJECTS = 0x4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_SCENERYSPLINES = 0x8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKSPLINES = 0x10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKSIDEOBJECTS = 0x20||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKMARKS = 0x40||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TOOLS = 0x80||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_WORLD = 0x100||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_LAYERS = 0x200||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRAINS = 0x400||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_CONSISTS = 0x800||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_ALL = -1||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Trainz Modules===&lt;br /&gt;
----&lt;br /&gt;
*Trainz module mode constants. &lt;br /&gt;
*These values define the various module environments that Trainz can be in. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  NO_MODULE = 0||Trainz not running in a module.&lt;br /&gt;
|-&lt;br /&gt;
|public define int SURVEYOR_MODULE = 1||Trainz is currently running in Surveyor.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DRIVER_MODULE = 2||Trainz is currently running in Driver.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
* [[TrainzScript Message Reference]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Camera Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Interface Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[ModuleInit Message]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]] AddDriverCharacter([[Class Asset|Asset]] driverCharacterAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCharacterAsset&#039;&#039;&#039; = Asset containing character to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCharacter if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter Casey = World.AddDriverCharacter(CaseyJones);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] AddDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.AddDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CancelCurrentEditingMode==&lt;br /&gt;
{{MethodHeader|public native void CancelCurrentEditingMode(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;
 World.CancelCurrentEditingMode();&lt;br /&gt;
;Notes&lt;br /&gt;
* Cancels out of any player entered editing mode, if relevant. This should only normally be called as a result of direct player action.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateBehavior==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]] CreateBehavior([[Class KUID|KUID]] kuid, [[Class Soup|Soup]] initialProperties)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of scenario.&lt;br /&gt;
&#039;&#039;&#039;initialProperties&#039;&#039;&#039; = Soup object containing initial properties for scenario.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the ScenarioBehavior created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior scenario = World.CreateBehavior(scenarioAsset, scenarioSoup);&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned ScenarioBehavior object may be ended by releasing all references to it (resetting all references to null).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrain==&lt;br /&gt;
{{MethodHeader|public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, string trackmarkName, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class TrackMark|TrackMark]] trackmark, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class Buildable|Buildable]] buildable, string trackName, float position, bool direction)}}&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class GSTrackSearch|GSTrackSearch]] tracksearch, bool avoidDerailments)}}&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class GSTrackSearch|GSTrackSearch]] tracksearch)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;consist&#039;&#039;&#039; = An array of vehicle KUIDs used to describe the required Train object.&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;buildable&#039;&#039;&#039; = Buildable on which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;trackName&#039;&#039;&#039; = Name of track within Buildable object.&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; = Distance at which the Train is to be placed relative to the start of the track.&lt;br /&gt;
*&#039;&#039;&#039;trackmark&#039;&#039;&#039; = Reference to Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = Orientation of Train relative to direction of track or trackmark.&lt;br /&gt;
*&#039;&#039;&#039;tracksearch&#039;&#039;&#039; = The location at which to create the train&lt;br /&gt;
*&#039;&#039;&#039;avoidDerailments&#039;&#039;&#039; = If true this function will fail and return null if creating the train would cause a derailment&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the Train created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = World.CreateTrain(consist, buildable, &amp;quot;Track 1&amp;quot;, 10.0, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*These methods create a train from a list of vehicles in a consist array.&lt;br /&gt;
*Depending on the variant of the method used, the train can be created at a Trackmark, specified by name or reference, or at a Buildable or Industry object.&lt;br /&gt;
*It is the responsibility of the script programmer to ensure that sufficient track exists at the given location to allow the train to be created.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;&#039;&#039;&#039;GSTrackSearch&#039;&#039;&#039; aliases added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteTrain==&lt;br /&gt;
{{MethodHeader|public native void DeleteTrain([[Class Train|Train]] train)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = train to be deleted from map.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteTrain(flyingScotsman);&lt;br /&gt;
;Notes&lt;br /&gt;
*Once a train has been deleted, care should be taken to avoid using its reference.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteVehicle==&lt;br /&gt;
{{MethodHeader|public native void DeleteVehicle([[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = vehicle to be deleted from its train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteVehicle(vehicles[vehicles.size()-1]);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use [[Class Train#GetVehicles|Train.GetVehicles()]] to obtain an array of vehicles for a given train.&lt;br /&gt;
*Use [[Class Vehicle#GetMyTrain|Vehicle.GetMyTrain()]] to obtain a train reference for a given vehicle.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==EndScenario==&lt;br /&gt;
{{MethodHeader|public void EndScenario(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = Amount of seconds to delay before ending the session&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.EndScenario(30.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindAsset==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]] FindAsset([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of Asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Given a valid KUID parameter, this method return an Asset reference if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset asset = World.FindAsset(kuid);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also Asset.FindAsset()&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] FindDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.FindDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAssetList==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]][ ] GetAssetList(string kind)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kind&#039;&#039;&#039; = String representing the Kind of asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of all assets of the given &#039;&#039;kind&#039;&#039;&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset[] Libraries = World.GetAssetList(&amp;quot;Library&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*All installed assets of the given &#039;&#039;kind&#039;&#039; are returned, irrespective of whether or not they are in use on the current map.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetBadWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Bad weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetBadWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBehaviors==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]][ ] GetBehaviors(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of top-level behaviors or rules on the currently loaded route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior[] rules = World.GetBehaviors();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPitch==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPitch(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera pitch, in radians&lt;br /&gt;
;Syntax&lt;br /&gt;
 float pitch = World.GetCameraPitch();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionX==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionX(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*X Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float X = World.GetCameraPositionX();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionY==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionY(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Y Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Y = World.GetCameraPositionY();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionZ==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionZ(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Z Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Z = World.GetCameraPositionZ();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraYaw==&lt;br /&gt;
{{MethodHeader|public native float GetCameraYaw(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera yaw, in radians&lt;br /&gt;
;Syntax&lt;br /&gt;
 float yaw = World.GetCameraYaw();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraZoom==&lt;br /&gt;
{{MethodHeader|public native float GetCameraZoom(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera zoom, in meters&lt;br /&gt;
;Syntax&lt;br /&gt;
 float zoom= World.GetCameraZoom();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Is this value equivalent to &#039;&#039;&#039;radius&#039;&#039;&#039; in [[#SetCameraAngle|SetCameraAngle()]]?&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentModule==&lt;br /&gt;
{{MethodHeader|public native int GetCurrentModule(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An integer representing the current Trainz module.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int module = World.GetCurrentModule();&lt;br /&gt;
;Notes&lt;br /&gt;
* See [[#Trainz Modules|Trainz Modules]] for details of the constants associated with this method. &lt;br /&gt;
* See [[ModuleInit Message]] for further details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentProfile==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]] GetCurrentProfile(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current session asset&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset currentSession = World.GetCurrentProfile();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentTrain==&lt;br /&gt;
{{MethodHeader|public native Train GetCurrentTrain(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The currently focused train&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train myTrain = World.GetCurrentTrain();&lt;br /&gt;
;Notes&lt;br /&gt;
* The current train is the one currently controlled by the user, which may not be the train the camera is focused on.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCharacterList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]][ ] GetDriverCharacterList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCharacter objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter[] drivers = World.GetDriverCharacterList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCommandList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]][ ] GetDriverCommandList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCommand objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand[] commands = World.GetDriverCommandList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameDate==&lt;br /&gt;
{{MethodHeader|public native int GetGameDate(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game day (1 - 31)&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameDate();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameMonth==&lt;br /&gt;
{{MethodHeader|public native int GetGameMonth(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game month (1 - 12)&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameMonth();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameObjectByID==&lt;br /&gt;
{{MethodHeader|public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetGameObjectByID([[Class GameObjectID|GameObjectID]] objectID, bool bTriggerLoad)&amp;lt;br&amp;gt;public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetGameObjectByID([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the object to find.&lt;br /&gt;
*&#039;&#039;&#039;bTriggerLoad&#039;&#039;&#039; = Optional, defaults to true. Whether to trigger an asynchronous load of any matching object (if it&#039;s not loaded already).&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Asynchronous search result object. &lt;br /&gt;
;Syntax&lt;br /&gt;
 AsyncObjectSearchResult search_result = World.GetGameObjectByID(objectID, true);  // Search for and load an object&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[HowTo/Search for objects in the world]] for a detailed guide on asynchronous searches.&lt;br /&gt;
*The retured object is a reference to the in-progress object search.&lt;br /&gt;
*When the search completes, a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncResult&amp;quot; will be posted to the result object.&lt;br /&gt;
*If bTriggerLoad is true, a further message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncLoadComplete&amp;quot; will be posted when all objects are loaded into memory. This message will still be posted if every object is already loaded.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameObjectByIDIfLoaded==&lt;br /&gt;
{{MethodHeader|public native [[Class GameObject|GameObject]] GetGameObjectByIDIfLoaded([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the boject to find.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* The object, if it exists and is currently loaded.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject my_object = World.GetGameObjectByID(objectID);&lt;br /&gt;
 if (my_object Interface.Print(&amp;quot;Object exists and is loaded&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameSeason==&lt;br /&gt;
{{MethodHeader|public native float GetGameSeason(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game season&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Season = World.GetGameSeason();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = mid-summer&lt;br /&gt;
*0.5 = mid-winter&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameTime==&lt;br /&gt;
{{MethodHeader|public native float GetGameTime(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Now = World.GetGameTime();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday&lt;br /&gt;
*0.25 = 6 p.m.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*0.75 = 6 a.m.&lt;br /&gt;
*1.0 = midday again&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert the normalised values to human readable times.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameYear==&lt;br /&gt;
{{MethodHeader|public native int GetGameYear(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game year.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameYear();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetGoodWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Good weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGoodWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetGroundDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Ground draw distance in metres.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGroundDrawDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetIndustryList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class GameObject|GameObject]][ ] GetIndustryList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the Industry objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject[] Industries = World.GetIndustryList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetJunctionList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Junction|Junction]][ ] GetJunctionList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackside junction objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Junction[] junctions = World.GetJunctionList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
*Junction objects attached to fixed track junctions are not returned by this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLayerList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetLayerList(int layerType)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*layerType = LAYER_ROUTE, LAYER_SESSION, or LAYER_BOTH&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Array of layer names&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] routeLayerNames = World.GetLayerList(World.LAYER_ROUTE);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLayerType==&lt;br /&gt;
{{MethodHeader|public native int GetLayerType(string layerName)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*layerName = The name of the layer&lt;br /&gt;
;Returned Value&lt;br /&gt;
*LAYER_ROUTE or LAYER_SESSION&lt;br /&gt;
;Syntax&lt;br /&gt;
 int layerType = World.GetLayerType(&amp;quot;MyLayer&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLibrary==&lt;br /&gt;
{{MethodHeader|public native [[Class Library|Library]] GetLibrary([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of script library asset to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the script library asset if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Library codelib = World.GetLibrary(LibraryKUID);&lt;br /&gt;
;Notes&lt;br /&gt;
*The [[Class Library|Library]] asset is initialised when this method is first called in a session.&lt;br /&gt;
*Since only one instance can exist, subsequent calls return a reference to the existing Library object.&lt;br /&gt;
*See [[Class Library|Library]] for notes on how to use this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLocalPlayerName==&lt;br /&gt;
{{MethodHeader|public native string GetLocalPlayerName(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The name of the local player&lt;br /&gt;
;Syntax&lt;br /&gt;
 string playerName = World.GetLocalPlayerName();&lt;br /&gt;
;Notes&lt;br /&gt;
* Gets the name of the local player, as should be used for setting ownership on DriverCharacters, etc.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in .TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetNamedObjectList==&lt;br /&gt;
{{MethodHeader|public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetNamedObjectList(string categoryFilter, string nameFilter, bool bNotifyOfExpiry)&amp;lt;br&amp;gt;public [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetNamedObjectList(string categoryFilter, string nameFilter)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;categoryFilter&#039;&#039;&#039; = A category filter to search for. Optional, provided a nameFilter parameter is provided. A category code reference can be found in [[Class AssetCategory|AssetCategory]].&lt;br /&gt;
*&#039;&#039;&#039;nameFilter&#039;&#039;&#039; = A partial object name to search for. Optional, provided a categoryFilter parameter is provided.&lt;br /&gt;
*&#039;&#039;&#039;bNotifyOfExpiry&#039;&#039;&#039; = Optional, defaults to false. If native code detects that the search results have changed then a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;Expired&amp;quot; will be posted to the result object, and the calling script can perform a new search if desired&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Asynchronous search result object. &lt;br /&gt;
;Syntax&lt;br /&gt;
 AsyncObjectSearchResult search_result = World.GetNamedObjectList(AssetCategory.Locomotive, &amp;quot;SD40-2&amp;quot;); // Search for all SD40-2 locomotives in the world&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[HowTo/Search for objects in the world]] for a detailed guide on asynchronous searches.&lt;br /&gt;
*The retured object is a reference to the in-progress object search.&lt;br /&gt;
*When the search completes, a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncResult&amp;quot; will be posted to the result object.&lt;br /&gt;
*With expiration notices are enabled, only one notification of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;Expired&amp;quot; will be posted for each search.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetSceneryDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Undefined.&lt;br /&gt;
;Notes&lt;br /&gt;
*Included for legacy script compatibility only. Has no effect.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSeconds==&lt;br /&gt;
{{MethodHeader|public native float GetSeconds(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current value of a floating point number incrementing once per second in real time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float start = World.GetSeconds();&lt;br /&gt;
 // do stuff&lt;br /&gt;
 float finish = World.GetSeconds();&lt;br /&gt;
 float period = finish - start;&lt;br /&gt;
;Notes&lt;br /&gt;
*Each call will return a float value containing the current value of an internal counter.&lt;br /&gt;
*Subtracting a later value from a value saved at an earlier call will enable the delay between the two calls to be established.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSignalList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Signal|Signal]][ ] GetSignalList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the signal objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Signal[] signals = World.GetSignalList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStringTable==&lt;br /&gt;
{{MethodHeader|public native [[Class StringTable|StringTable]] GetStringTable(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The StringTable for the current session.&lt;br /&gt;
;Syntax&lt;br /&gt;
 StringTable data = World.GetStringTable();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsist==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Soup|Soup]] GetSurveyorSavedConsist(string name)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; = Name of the consist to retrieve.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a Soup definition of the named consist if it exists, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Soup consist = World.GetSurveyorSavedConsist(&amp;quot;Brighton Belle&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Remember that the returned data is in a Soup format, which is not the same thing as a Train. &lt;br /&gt;
*[[Class TrainUtil#CreateTrainFromSoup|TrainUtil.CreateTrainFromSoup()]] can be used to create a train from the returned Soup.&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
*Obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsistList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetSurveyorSavedConsistList()}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of names of all the saved consist objects in Surveyor.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] consists = World.GetSurveyorSavedConsistList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
*Obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTimeElapsed==&lt;br /&gt;
{{MethodHeader|public native float GetTimeElapsed(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The number of real-time seconds that have passed since the start of the current session. &lt;br /&gt;
;Syntax&lt;br /&gt;
 float secondsElapsed = World.GetTimeElapsed();&lt;br /&gt;
;Notes&lt;br /&gt;
*This measure of time stops passing while the game is paused.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrackmarkList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class TrackMark|TrackMark]][ ] GetTrackmarkList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackmark objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trackmark[] trackmarks = World.GetTrackmarkList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Train|Train]][ ] GetTrainList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trains for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train[] trains = World.GetTrainList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzBuild==&lt;br /&gt;
{{MethodHeader|public native int GetTrainzBuild(void)}}&lt;br /&gt;
;Parameters;&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Gets the current build number of Trainz. &lt;br /&gt;
;Syntax&lt;br /&gt;
 int build = World.GetTrainzBuild();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the build number you can see in the bottom-right side of the main Trainz menu screen.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzVersion==&lt;br /&gt;
{{MethodHeader|public native float GetTrainzVersion(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The TRS version number.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float version = World.GetTrainzVersion();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the version number of Content manager (for example 4.6). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTriggerList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Trigger|Trigger]][ ] GetTriggerList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trigger objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trigger[] triggers = World.GetTriggerList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
*This method does not return scenery triggers, ie those attached to SceneryWithTrack objects and their descendants.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetVehicleList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Vehicle|Vehicle]][ ] GetVehicleList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the vehicles in the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Vehicle[] vehicles = World.GetVehicleList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherChangeability==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherChangeability(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Changeability_Constants|Weather Changeability Constants]] denoting the variability of weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int variability = World.GetWeatherChangeability();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherType==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherType(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Type_Constants|Weather Type Constants]] denoting the current weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int weather = World.GetWeatherType();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsAssetRestrictionInEffect==&lt;br /&gt;
{{MethodHeader|public native bool IsAssetRestrictionInEffect(string)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether this game world has Asset Restrictions. &lt;br /&gt;
;Syntax&lt;br /&gt;
 bool assetRestrictionsExist = World.IsAssetRestrictionInEffect();&lt;br /&gt;
;Notes&lt;br /&gt;
*Multiplayer Sessions require Asset Restrictions to be in effect to avoid compatibility issues between peers.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsLayerVisible==&lt;br /&gt;
{{MethodHeader|public native bool IsLayerVisible(string layerName)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*layerName = Name of the layer to check&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether the layer is visible&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool isVisible = World.IsLayerVisible(&amp;quot;MyLayer&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadMap==&lt;br /&gt;
{{MethodHeader|public native bool LoadMap([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of map to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadMap(mapKUID) Interface.Print(&amp;quot;Map loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Map load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use World.[[#FindKUID|FindKUID()]] to find the desired route KUID.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadSession==&lt;br /&gt;
{{MethodHeader|public native bool LoadSession([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of session to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadSession(sessionKUID) Interface.Print(&amp;quot;Session loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Session load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use World.[[#FindKUID|FindKUID()]] to find the desired session KUID.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Play2DSound==&lt;br /&gt;
{{MethodHeader|public float Play2DSound([[Class Asset|Asset]] asset, string wave)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Undefined.&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;);        &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;)); &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&amp;quot; sound file from the given asset&#039;s folder.&lt;br /&gt;
*The sound is non directional and can be mono or stereo. &lt;br /&gt;
*This method does not return after the sound has finished playing, it returns with the length of the sound as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PlaySound==&lt;br /&gt;
{{MethodHeader|public native float PlaySound&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt)&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt, bool loop)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
*&#039;&#039;&#039;vol&#039;&#039;&#039; = Volume level to play the sound at (0 to 1)&amp;lt;- These values taken from TRS2019 world.gs file comments&lt;br /&gt;
*&#039;&#039;&#039;near&#039;&#039;&#039; = Distance from the target asset at which the sound will be played at maximum volume.&lt;br /&gt;
*&#039;&#039;&#039;far&#039;&#039;&#039; = Distance from the target asset at which the sound will become inaudible.&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to which the sound will be attached if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;pt&#039;&#039;&#039; = Name of attachment point in the target object if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;loop&#039;&#039;&#039; = (Optional) If true the sound will loop continuously.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Sound length in seconds for Trainz before TS12&lt;br /&gt;
* Undefined for TS12 and TANE&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1000.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&#039;&#039; sound file from the given asset&#039;s folder.&lt;br /&gt;
*If the sound is to be directional a mono sound file is required. &lt;br /&gt;
*This method does not return after the sound has finished playing: it returns as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
*If you want to wait for the sound to complete playing before moving on, wrap the PlaySound() call up in a Sleep() call. &#039;&#039;&#039;Note!&#039;&#039;&#039; This works only in Trainz versions before TS12. For newer versions, TS12 and TANE, you can hard-code the duration of the sound, or store it in the extensions container of the config.txt file.&lt;br /&gt;
*The sound volume will be at a maximum for a camera position at or less than the value of the &#039;&#039;near&#039;&#039; parameter and will reduce with distance until the hearing position reaches &#039;&#039;far&#039;&#039;, when the sound will be inaudible.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCharacter([[Class DriverCharacter|DriverCharacter]] driver)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driver&#039;&#039;&#039; = DriverCharacter to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCharacter(dave);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCommand==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCommand([[Class DriverCommand|DriverCommand]] command)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;command&#039;&#039;&#039; = DriverCommand to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCommand(driverCommand);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RestartSession==&lt;br /&gt;
{{MethodHeader|public native bool RestartSession()}}&lt;br /&gt;
;Parameters&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RestartSession();&lt;br /&gt;
;Notes&lt;br /&gt;
*Valid in Driver mode only.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetBadWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Bad weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetBadWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCamera==&lt;br /&gt;
{{MethodHeader|public native bool SetCamera([[Class MapObject|MapObject]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Junction|Junction]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Vehicle|Vehicle]] focus, int cameraMode)&amp;lt;br&amp;gt;public native void SetCamera([[Class Train|Train]] focus, int cameraMode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;focus&#039;&#039;&#039; = Object on which the camera is to be focused.&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Mode]] constants defining the view which should be assigned to the camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The first variant returns a boolean to indicate success or failure.&lt;br /&gt;
*Remaining variants do not return a value&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCamera(train.GetVehicles[0],World.CAMERA_TRACKING); // sets the camera to track the first vehicle in the train.&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Junction alias removed in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraAngle==&lt;br /&gt;
{{MethodHeader|public void SetCameraAngle(float yaw, float pitch, float radius)&amp;lt;br&amp;gt;public obsolete void SetCameraAngle(int yaw, int pitch, float radius)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;yaw&#039;&#039;&#039; = Camera rotation in radians (float) or degrees (int), 90 is a direct front view.&lt;br /&gt;
*&#039;&#039;&#039;pitch&#039;&#039;&#039; = Camera angle relative to the horizon in radians (float), or degrees (int), 0 is horizontal, 90 points vertically upwards.&lt;br /&gt;
*&#039;&#039;&#039;radius&#039;&#039;&#039; = Distance in metres to the object in focus.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraAngle(90,0,25); // Sets the camera to a direct frontal view at 25 metres from the currently focused object.&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;Radius&#039;&#039; is measured from the object origin point (0,0,0). If there&#039;s no target object this will be the distance to the ground.&lt;br /&gt;
*Note difference in units of &#039;&#039;yaw&#039;&#039; and &#039;&#039;pitch&#039;&#039; depending in the method signature used.&lt;br /&gt;
*The integer version of this method call is obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraFlags==&lt;br /&gt;
{{MethodHeader|public native void SetCameraFlags(int flags)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039;  integer value defining what the user is permitted to do with the game camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 // User is permitted to select External or Tracking views only.&lt;br /&gt;
    World.SetCameraFlags(World.CAMERA_EXTERNAL | World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use any combination of [[#Camera_Flags|Camera Flags]] and [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraMode==&lt;br /&gt;
{{MethodHeader|public void SetCameraMode(int mode)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = Camera mode to select.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraMode(World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetEditingCamera==&lt;br /&gt;
{{MethodHeader|public void SetEditingCamera([[Class GameObject|GameObject]] actor, bool bIsActorEditingCamera)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;actor&#039;&#039;&#039; = The script who is intended to edit the camera position.&lt;br /&gt;
*&#039;&#039;&#039;bIsActorEditingCamera&#039;&#039;&#039; = True to begin editing, or False to end the editing operation. &lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetEditingCamera(myScript, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*Hints to the caching systems that the camera position is in the process of being changed. This may reduce the amount of streaming that will occur until the change is complete.&lt;br /&gt;
*This is intended for use-cases where the decision to move the camera happens in advance of the actual call to [[#SetCamera|SetCamera()]] or etc., for example when the new camera target needs to be streamed in first.&lt;br /&gt;
*There is no advantage in calling this unless your code then sleeps/waits before undoing the call.&lt;br /&gt;
*It is not required to call this before using SetCamera() etc.&lt;br /&gt;
*A boolean state is stored per actor; multiple calls to enable editing on a single actor do not need to be matched to multiple calls to disable editing.&lt;br /&gt;
*It is counterproductive to call this when transitioning the camera over a short distance (ie. where the source and target locations can see each other). If jumping to a new location, followed by a visual camera transition at the new location, camera editing may be enabled around the target-selection for the jump, and the jump itself, but should be disabled before proceeding with the transition.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameDate==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(int year, int month, int date)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;year&#039;&#039;&#039; = The year to set (1970-2038)&lt;br /&gt;
*&#039;&#039;&#039;month&#039;&#039;&#039; = The month to set (1-12)&lt;br /&gt;
*&#039;&#039;&#039;day&#039;&#039;&#039; = The day to set (1-31)&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(2000, 12, 25);  // sets date to 25 December 2000&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTime==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = new gane time to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(0.5);  // sets time to midnight&lt;br /&gt;
;Notes&lt;br /&gt;
*Game time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday&lt;br /&gt;
*0.25 = 6 p.m.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*0.75 = 6 a.m.&lt;br /&gt;
*1.0 = midday again&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert human readable times to normalised values. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTimeRate==&lt;br /&gt;
{{MethodHeader|public native void SetGameTimeRate(float rate)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;rate&#039;&#039;&#039; = New time rate to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTimeRate(World.TIME_RATE_8X); // sets game time to advance by 8 minutes per minute of real world time.&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Time_Rate_Constants|Time Rate Constants]] to define the parameter.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetGoodWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Good weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGoodWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetGroundDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Ground draw distance in metres.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGroundDrawDistance(1000.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Compatibility warning: Use of this function is not recommended, it may become non-functional in future Trainz versions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetLayerVisible==&lt;br /&gt;
{{MethodHeader|public native void IsLayerVisible(string layerName, bool visible)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*layerName = Name of the layer to check&lt;br /&gt;
*visible = Whether to set the layer visible or not&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.IsLayerVisible(&amp;quot;MyLayer&amp;quot;, False);&lt;br /&gt;
;Notes&lt;br /&gt;
*Show/Hide a route/session layer.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetSceneryDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = unused.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
* Does nothing. Included for script compatibility only.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetTargetObserver==&lt;br /&gt;
{{MethodHeader|public void SetTargetObserver([[Class GameObject|GameObject]] observer)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;observer&#039;&#039;&#039; = The game object to receive targeting messages.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SetTargetObserver(self);&lt;br /&gt;
;Notes&lt;br /&gt;
* It is unlikely a script programmer would ever need to use this method.&lt;br /&gt;
* Causes the specified object to receive &amp;quot;Track&amp;quot;, &amp;quot;LeftClick&amp;quot; messages when a track is clicked. Causes the specified object to receive &amp;quot;Interface-Event&amp;quot;, &amp;quot;Left-Click&amp;quot; messages when a targetable MapObject is clicked. May cause the functionality of a left mouse click to change from what the user is expecting, so should be used with caution. Used in modal scripts to allow the user to indicate a location for train placement, etc. As there is only a single observer at any given time, the script must take care to only call this function when entering placement mode at the user&#039;s request.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWeather==&lt;br /&gt;
{{MethodHeader|public native void SetWeather(int type, int changeability)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;type&#039;&#039;&#039; = Weather conditions as defined by one of the [[#Weather_Type_Constants|Weather Type Constants]].&lt;br /&gt;
*&#039;&#039;&#039;change&#039;&#039;&#039; = Weather variation as defined by one of the [[#Weather_Changeability_Constants|Weather Changeability Constants]].&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_HEAVY_SNOW,World.WEATHER_CHANGEABILITY_EXTREME); // April in Paris.&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWorldEditModeEnabled==&lt;br /&gt;
{{MethodHeader|public native bool SetWorldEditModeEnabled(int editFlags, bool enable)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;editFlags&#039;&#039;&#039; = Bitmask specifying which modes to alter, see PERMIT_EDIT_*&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = Whether to enable or disable the mode&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether the change was completely successful&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWorldEditModeEnabled(World.PERMIT_EDIT_TRAINS | World.PERMIT_EDIT_CONSISTS, True); // Enable player editing of trains and consists&lt;br /&gt;
;Notes&lt;br /&gt;
*This does not affect scripts which may alter the world, only the availability of the player world editing tools (i.e, the Surveyor tabs).&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SynchronouslyLoadGameObjectByID==&lt;br /&gt;
{{MethodHeader|public [[Class GameObject|GameObject]] SynchronouslyLoadGameObjectByID([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the object to find.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* The object, if it exists.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject my_object = World.SynchronouslyLoadGameObjectByID(objectID);&lt;br /&gt;
 if (my_object Interface.Print(&amp;quot;Object exists and has been loaded if required&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is usable only by script &#039;thread&#039; functions and will throw an exception if called incorrectly.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UpdatePositionToGroundHeight==&lt;br /&gt;
{{MethodHeader|public native bool UpdatePositionToGroundHeight([[Class WorldCoordinate|WorldCoordinate]] position)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; (in, out) = Position object to update with the ground height at it&#039;s location&lt;br /&gt;
;Returned Value&lt;br /&gt;
* True if the ground position was updated&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.UpdatePositionToGroundHeight(position) Interface.Print(&amp;quot;Position was updated&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This updates the input &#039;&#039;position&#039;&#039; object with the ground height at that location.&lt;br /&gt;
*This process may fail if the ground data at the specified location is not currently loaded.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UpdatePositionToSurfaceHeight==&lt;br /&gt;
{{MethodHeader|public native bool UpdatePositionToSurfaceHeight([[Class WorldCoordinate|WorldCoordinate]] position)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; (in, out) = Position object to update with the water height at it&#039;s location&lt;br /&gt;
;Returned Value&lt;br /&gt;
* True if the ground position was updated&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.UpdatePositionToGroundHeight(position) Interface.Print(&amp;quot;Position was updated&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This updates the input &#039;&#039;position&#039;&#039; object with the water height at that location. If no water is present, the position is adjusted to the ground height.&lt;br /&gt;
*This process may fail if the ground data at the specified location is not currently loaded.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCamera==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera([[Class GameObject|GameObject]] target)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to set focus to.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraMode==&lt;br /&gt;
{{MethodHeader|public native void UserSetCameraMode(int mode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Modes]]&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCameraMode(World.CAMERA_ROAMING);  // switches to roaming view if permitted.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method respects the current [[#Camera_Flags|Camera Flag]] settings, disallowing any change which the flags do not permit.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraPosition==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera([[Class WorldCoordinate|WorldCoordinate]] camPos)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;camPos&#039;&#039;&#039; = World coordinates to set camera to&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
* For camera modes which do not need to target specific objects, this allows the camera to be set to an arbitrary world position.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26592</id>
		<title>Class World</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26592"/>
		<updated>2020-12-28T17:07:29Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Update to current state of world.gs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**World (world.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*World is a static class used to access various aspects of the Trainz environment.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;World.&#039;&#039;, for example:&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_LIGHT_SNOW,World.WEATHER_CHANGEABILITY_PERIODIC);&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera View Modes===&lt;br /&gt;
----&lt;br /&gt;
*These values can be used either to choose the current camera viewing mode through World.[[#SetCameraMode|SetCameraMode()]], or to restrict certain camera modes from being accessed through methods such as World.[[#SetCamera|SetCamera()]].&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_INTERNAL = 1||Internal cabin camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_EXTERNAL = 2||External train camera view&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_TRACKING = 4||External tracking camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_ROAMING = 128||Roaming camera view.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera Flags===&lt;br /&gt;
----&lt;br /&gt;
*These flags are used in addition to the Camera Mode Flags to allow or disallow specific camera actions. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_SWITCH_VIEWS = 8||User permitted to swap between the camera views.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_VEHICLES = 16||User permitted to swap vehicles within the current train.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_TRAINS = 32||User permitted to swap to other trains which are in the consist menu.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_LOCKED = 64||User is NOT permitted to adjust camera (i.e. zoom, pan etc.).&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_NORMAL = * ||Normal camera mode where everything is permitted.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|&amp;lt;sup&amp;gt;* NOTE: CAMERA_NORMAL = CAMERA_INTERNAL | CAMERA_EXTERNAL | CAMERA_TRACKING | CAMERA_SWITCH_VIEWS | CAMERA_SWITCH_VEHICLES | CAMERA_SWITCH_TRAINS&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the current state of the weather in Trainz. &lt;br /&gt;
*A variety of weather conditions are supported and can be changed by using one of these values with the World.[[#SetWeather|SetWeather()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_TYPE_CLEAR = 0||Clear weather, no clouds, rain or snow.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_CLOUDY = 1||Cloudy weather, no rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_DRIZZLE = 2||Drizzle, light rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_RAIN = 3||Rainy weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_STORMY = 4||Stormy weather that includes lightning and thunder.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_LIGHT_SNOW = 5||Snowing lightly.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_MEDIUM_SNOW = 6||Medium level snow fall.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_HEAVY_SNOW = 7||Heavy snow fall.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Changeability Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the changeability settings for the weather. &lt;br /&gt;
*Weather changeability refers to variability of weather conditions rather than to a specific weather type.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_CHANGEABILITY_NONE = 0||Weather remains static.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_PERIODIC = 1||Periodic changes in weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_EXTREME = 2||Extreme and frequent changes in weather. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Values===&lt;br /&gt;
----&lt;br /&gt;
*Time constants defined in seconds.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define float TIME_SECOND = 1.0f||One second.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_MINUTE = TIME_SECOND * 60.0f||One minute, 60.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_HOUR = TIME_MINUTE * 60.0f||One hour, 60.0 minutes, 3600.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_DAY = TIME_HOUR * 24.0f||One day, 24 hours, 1440.0 minutes, 86400.0 seconds.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Rate Constants===&lt;br /&gt;
----&lt;br /&gt;
*Values that define the time rates relative to normal time. &lt;br /&gt;
*These constants can be used to set the time rate that Trainz runs out through the World.[[#SetGameTimeRate|SetGameTimeRate()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  TIME_RATE_1X = 0||Real time (i.e. time in Trainz passes at the same rate as in the real world)&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_2X = 1||Time passes at twice normal speed.&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_4X = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_8X = 3||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_16X = 4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_32X = 5||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_60X = 6||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_120X = 7||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_240X = 8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_360X = 9||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_480X = 10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_720X = 11||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_960X = 12||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1200X = 13||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1440X = 14||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Layer Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*These constants can be used for querying route/session layers via [[#GetLayerList|GetLayerList]] and [[#GetLayerType|GetLayerType]].&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int LAYER_INVALID = 0||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_ROUTE = 1||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_SESSION = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int LAYER_BOTH = 3||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===World Editing Mode Constants===&lt;br /&gt;
----&lt;br /&gt;
*These constants can be used to set editing modes through World.[[#SetWorldEditModeEnabled|SetWorldEditModeEnabled()]].&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int PERMIT_EDIT_NONE = 0x0||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TOPOLOGY = 0x1||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_PAINT = 0x2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_SCENERYOBJECTS = 0x4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_SCENERYSPLINES = 0x8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKSPLINES = 0x10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKSIDEOBJECTS = 0x20||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRACKMARKS = 0x40||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TOOLS = 0x80||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_WORLD = 0x100||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_LAYERS = 0x200||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_TRAINS = 0x400||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_CONSISTS = 0x800||&lt;br /&gt;
|-&lt;br /&gt;
|public define int PERMIT_EDIT_ALL = -1||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Trainz Modules===&lt;br /&gt;
----&lt;br /&gt;
*Trainz module mode constants. &lt;br /&gt;
*These values define the various module environments that Trainz can be in. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  NO_MODULE = 0||Trainz not running in a module.&lt;br /&gt;
|-&lt;br /&gt;
|public define int SURVEYOR_MODULE = 1||Trainz is currently running in Surveyor.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DRIVER_MODULE = 2||Trainz is currently running in Driver.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
* [[TrainzScript Message Reference]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Camera Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Interface Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[ModuleInit Message]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]] AddDriverCharacter([[Class Asset|Asset]] driverCharacterAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCharacterAsset&#039;&#039;&#039; = Asset containing character to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCharacter if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter Casey = World.AddDriverCharacter(CaseyJones);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] AddDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.AddDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CancelCurrentEditingMode==&lt;br /&gt;
{{MethodHeader|public native void CancelCurrentEditingMode(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;
 World.CancelCurrentEditingMode();&lt;br /&gt;
;Notes&lt;br /&gt;
* Cancels out of any player entered editing mode, if relevant. This should only normally be called as a result of direct player action.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateBehavior==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]] CreateBehavior([[Class KUID|KUID]] kuid, [[Class Soup|Soup]] initialProperties)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of scenario.&lt;br /&gt;
&#039;&#039;&#039;initialProperties&#039;&#039;&#039; = Soup object containing initial properties for scenario.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the ScenarioBehavior created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior scenario = World.CreateBehavior(scenarioAsset, scenarioSoup);&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned ScenarioBehavior object may be ended by releasing all references to it (resetting all references to null).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrain==&lt;br /&gt;
{{MethodHeader|public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, string trackmarkName, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class TrackMark|TrackMark]] trackmark, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class Buildable|Buildable]] buildable, string trackName, float position, bool direction)}}&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class GSTrackSearch|GSTrackSearch]] tracksearch, bool avoidDerailments)}}&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class GSTrackSearch|GSTrackSearch]] tracksearch)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;consist&#039;&#039;&#039; = An array of vehicle KUIDs used to describe the required Train object.&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;buildable&#039;&#039;&#039; = Buildable on which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;trackName&#039;&#039;&#039; = Name of track within Buildable object.&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; = Distance at which the Train is to be placed relative to the start of the track.&lt;br /&gt;
*&#039;&#039;&#039;trackmark&#039;&#039;&#039; = Reference to Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = Orientation of Train relative to direction of track or trackmark.&lt;br /&gt;
*&#039;&#039;&#039;tracksearch&#039;&#039;&#039; = The location at which to create the train&lt;br /&gt;
*&#039;&#039;&#039;avoidDerailments&#039;&#039;&#039; = If true this function will fail and return null if creating the train would cause a derailment&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the Train created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = World.CreateTrain(consist, buildable, &amp;quot;Track 1&amp;quot;, 10.0, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*These methods create a train from a list of vehicles in a consist array.&lt;br /&gt;
*Depending on the variant of the method used, the train can be created at a Trackmark, specified by name or reference, or at a Buildable or Industry object.&lt;br /&gt;
*It is the responsibility of the script programmer to ensure that sufficient track exists at the given location to allow the train to be created.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;&#039;&#039;&#039;GSTrackSearch&#039;&#039;&#039; aliases added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteTrain==&lt;br /&gt;
{{MethodHeader|public native void DeleteTrain([[Class Train|Train]] train)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = train to be deleted from map.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteTrain(flyingScotsman);&lt;br /&gt;
;Notes&lt;br /&gt;
*Once a train has been deleted, care should be taken to avoid using its reference.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteVehicle==&lt;br /&gt;
{{MethodHeader|public native void DeleteVehicle([[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = vehicle to be deleted from its train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteVehicle(vehicles[vehicles.size()-1]);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use [[Class Train#GetVehicles|Train.GetVehicles()]] to obtain an array of vehicles for a given train.&lt;br /&gt;
*Use [[Class Vehicle#GetMyTrain|Vehicle.GetMyTrain()]] to obtain a train reference for a given vehicle.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==EndScenario==&lt;br /&gt;
{{MethodHeader|public void EndScenario(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = Amount of seconds to delay before ending the session&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.EndScenario(30.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindAsset==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]] FindAsset([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of Asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Given a valid KUID parameter, this method return an Asset reference if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset asset = World.FindAsset(kuid);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also Asset.FindAsset()&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] FindDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.FindDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAssetList==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]][ ] GetAssetList(string kind)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kind&#039;&#039;&#039; = String representing the Kind of asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of all assets of the given &#039;&#039;kind&#039;&#039;&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset[] Libraries = World.GetAssetList(&amp;quot;Library&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*All installed assets of the given &#039;&#039;kind&#039;&#039; are returned, irrespective of whether or not they are in use on the current map.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetBadWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Bad weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetBadWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBehaviors==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]][ ] GetBehaviors(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of top-level behaviors or rules on the currently loaded route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior[] rules = World.GetBehaviors();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPitch==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPitch(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera pitch, in radians&lt;br /&gt;
;Syntax&lt;br /&gt;
 float pitch = World.GetCameraPitch();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionX==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionX(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*X Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float X = World.GetCameraPositionX();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionY==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionY(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Y Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Y = World.GetCameraPositionY();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionZ==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetCameraPositionZ(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Z Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Z = World.GetCameraPositionZ();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraYaw==&lt;br /&gt;
{{MethodHeader|public native float GetCameraYaw(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera yaw, in radians&lt;br /&gt;
;Syntax&lt;br /&gt;
 float yaw = World.GetCameraYaw();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraZoom==&lt;br /&gt;
{{MethodHeader|public native float GetCameraZoom(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Current camera zoom, in meters&lt;br /&gt;
;Syntax&lt;br /&gt;
 float zoom= World.GetCameraZoom();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Is this value equivalent to &#039;&#039;&#039;radius&#039;&#039;&#039; in [[#SetCameraAngle|SetCameraAngle()]]?&amp;lt;/font&amp;gt;&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentModule==&lt;br /&gt;
{{MethodHeader|public native int GetCurrentModule(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An integer representing the current Trainz module.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int module = World.GetCurrentModule();&lt;br /&gt;
;Notes&lt;br /&gt;
* See [[#Trainz Modules|Trainz Modules]] for details of the constants associated with this method. &lt;br /&gt;
* See [[ModuleInit Message]] for further details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentProfile==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]] GetCurrentProfile(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current session asset&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset currentSession = World.GetCurrentProfile();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentTrain==&lt;br /&gt;
{{MethodHeader|public native Train GetCurrentTrain(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The currently focused train&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train myTrain = World.GetCurrentTrain();&lt;br /&gt;
;Notes&lt;br /&gt;
* The current train is the one currently controlled by the user, which may not be the train the camera is focused on.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCharacterList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]][ ] GetDriverCharacterList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCharacter objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter[] drivers = World.GetDriverCharacterList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCommandList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]][ ] GetDriverCommandList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCommand objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand[] commands = World.GetDriverCommandList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameDate==&lt;br /&gt;
{{MethodHeader|public native int GetGameDate(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game day (1 - 31)&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameDate();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameMonth==&lt;br /&gt;
{{MethodHeader|public native int GetGameMonth(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game month (1 - 12)&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameMonth();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameObjectByID==&lt;br /&gt;
{{MethodHeader|public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetGameObjectByID([[Class GameObjectID|GameObjectID]] objectID, bool bTriggerLoad)&amp;lt;br&amp;gt;public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetGameObjectByID([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the object to find.&lt;br /&gt;
*&#039;&#039;&#039;bTriggerLoad&#039;&#039;&#039; = Optional, defaults to true. Whether to trigger an asynchronous load of any matching object (if it&#039;s not loaded already).&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Asynchronous search result object. &lt;br /&gt;
;Syntax&lt;br /&gt;
 AsyncObjectSearchResult search_result = World.GetGameObjectByID(objectID, true);  // Search for and load an object&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[HowTo/Search for objects in the world]] for a detailed guide on asynchronous searches.&lt;br /&gt;
*The retured object is a reference to the in-progress object search.&lt;br /&gt;
*When the search completes, a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncResult&amp;quot; will be posted to the result object.&lt;br /&gt;
*If bTriggerLoad is true, a further message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncLoadComplete&amp;quot; will be posted when all objects are loaded into memory. This message will still be posted if every object is already loaded.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameObjectByIDIfLoaded==&lt;br /&gt;
{{MethodHeader|public native [[Class GameObject|GameObject]] GetGameObjectByIDIfLoaded([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the boject to find.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* The object, if it exists and is currently loaded.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject my_object = World.GetGameObjectByID(objectID);&lt;br /&gt;
 if (my_object Interface.Print(&amp;quot;Object exists and is loaded&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameSeason==&lt;br /&gt;
{{MethodHeader|public native float GetGameSeason(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game season&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Season = World.GetGameSeason();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = mid-summer&lt;br /&gt;
*0.5 = mid-winter&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameTime==&lt;br /&gt;
{{MethodHeader|public native float GetGameTime(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Now = World.GetGameTime();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday&lt;br /&gt;
*0.25 = 6 p.m.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*0.75 = 6 a.m.&lt;br /&gt;
*1.0 = midday again&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert the normalised values to human readable times.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameYear==&lt;br /&gt;
{{MethodHeader|public native int GetGameYear(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game year.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int Now = World.GetGameYear();&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetGoodWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Good weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGoodWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetGroundDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Ground draw distance in metres.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGroundDrawDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetIndustryList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class GameObject|GameObject]][ ] GetIndustryList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the Industry objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject[] Industries = World.GetIndustryList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetJunctionList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Junction|Junction]][ ] GetJunctionList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackside junction objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Junction[] junctions = World.GetJunctionList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
*Junction objects attached to fixed track junctions are not returned by this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLayerList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetLayerList(int layerType)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*layerType = LAYER_ROUTE, LAYER_SESSION, or LAYER_BOTH&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Array of layer names&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] routeLayerNames = World.GetLayerList(World.LAYER_ROUTE);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLayerType==&lt;br /&gt;
{{MethodHeader|public native int GetLayerType(string layerName)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*layerName = The name of the layer&lt;br /&gt;
;Returned Value&lt;br /&gt;
*LAYER_ROUTE or LAYER_SESSION&lt;br /&gt;
;Syntax&lt;br /&gt;
 int layerType = World.GetLayerType(&amp;quot;MyLayer&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLibrary==&lt;br /&gt;
{{MethodHeader|public native [[Class Library|Library]] GetLibrary([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of script library asset to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the script library asset if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Library codelib = World.GetLibrary(LibraryKUID);&lt;br /&gt;
;Notes&lt;br /&gt;
*The [[Class Library|Library]] asset is initialised when this method is first called in a session.&lt;br /&gt;
*Since only one instance can exist, subsequent calls return a reference to the existing Library object.&lt;br /&gt;
*See [[Class Library|Library]] for notes on how to use this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLocalPlayerName==&lt;br /&gt;
{{MethodHeader|public native string GetLocalPlayerName(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The name of the local player&lt;br /&gt;
;Syntax&lt;br /&gt;
 string playerName = World.GetLocalPlayerName();&lt;br /&gt;
;Notes&lt;br /&gt;
* Gets the name of the local player, as should be used for setting ownership on DriverCharacters, etc.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in .TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetNamedObjectList==&lt;br /&gt;
{{MethodHeader|public native [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetNamedObjectList(string categoryFilter, string nameFilter, bool bNotifyOfExpiry)&amp;lt;br&amp;gt;public [[Class AsyncObjectSearchResult|AsyncObjectSearchResult]] GetNamedObjectList(string categoryFilter, string nameFilter)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;categoryFilter&#039;&#039;&#039; = A category filter to search for. Optional, provided a nameFilter parameter is provided. A category code reference can be found in [[Class AssetCategory|AssetCategory]].&lt;br /&gt;
*&#039;&#039;&#039;nameFilter&#039;&#039;&#039; = A partial object name to search for. Optional, provided a categoryFilter parameter is provided.&lt;br /&gt;
*&#039;&#039;&#039;bNotifyOfExpiry&#039;&#039;&#039; = Optional, defaults to false. If native code detects that the search results have changed then a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;Expired&amp;quot; will be posted to the result object, and the calling script can perform a new search if desired&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Asynchronous search result object. &lt;br /&gt;
;Syntax&lt;br /&gt;
 AsyncObjectSearchResult search_result = World.GetNamedObjectList(AssetCategory.Locomotive, &amp;quot;SD40-2&amp;quot;); // Search for all SD40-2 locomotives in the world&lt;br /&gt;
;Notes&lt;br /&gt;
*See [[HowTo/Search for objects in the world]] for a detailed guide on asynchronous searches.&lt;br /&gt;
*The retured object is a reference to the in-progress object search.&lt;br /&gt;
*When the search completes, a message of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;AsyncResult&amp;quot; will be posted to the result object.&lt;br /&gt;
*With expiration notices are enabled, only one notification of type &amp;quot;ObjectSearch&amp;quot;,&amp;quot;Expired&amp;quot; will be posted for each search.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native float GetSceneryDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Undefined.&lt;br /&gt;
;Notes&lt;br /&gt;
*Included for legacy script compatibility only. Has no effect.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSeconds==&lt;br /&gt;
{{MethodHeader|public native float GetSeconds(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current value of a floating point number incrementing once per second in real time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float start = World.GetSeconds();&lt;br /&gt;
 // do stuff&lt;br /&gt;
 float finish = World.GetSeconds();&lt;br /&gt;
 float period = finish - start;&lt;br /&gt;
;Notes&lt;br /&gt;
*Each call will return a float value containing the current value of an internal counter.&lt;br /&gt;
*Subtracting a later value from a value saved at an earlier call will enable the delay between the two calls to be established.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSignalList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Signal|Signal]][ ] GetSignalList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the signal objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Signal[] signals = World.GetSignalList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStringTable==&lt;br /&gt;
{{MethodHeader|public native [[Class StringTable|StringTable]] GetStringTable(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The StringTable for the current session.&lt;br /&gt;
;Syntax&lt;br /&gt;
 StringTable data = World.GetStringTable();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsist==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Soup|Soup]] GetSurveyorSavedConsist(string name)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; = Name of the consist to retrieve.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a Soup definition of the named consist if it exists, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Soup consist = World.GetSurveyorSavedConsist(&amp;quot;Brighton Belle&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Remember that the returned data is in a Soup format, which is not the same thing as a Train. &lt;br /&gt;
*TrainUtil.CreateTrainFormSoup() can be used to create a train from the returned Soup.&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
*Obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsistList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetSurveyorSavedConsistList()}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of names of all the saved consist objects in Surveyor.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] consists = World.GetSurveyorSavedConsistList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
*Obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTimeElapsed==&lt;br /&gt;
{{MethodHeader|public native float GetTimeElapsed(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The number of real-time seconds that have passed since the start of the current session. &lt;br /&gt;
;Syntax&lt;br /&gt;
 float secondsElapsed = World.GetTimeElapsed();&lt;br /&gt;
;Notes&lt;br /&gt;
*This measure of time stops passing while the game is paused.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrackmarkList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class TrackMark|TrackMark]][ ] GetTrackmarkList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackmark objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trackmark[] trackmarks = World.GetTrackmarkList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Train|Train]][ ] GetTrainList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trains for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train[] trains = World.GetTrainList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzBuild==&lt;br /&gt;
{{MethodHeader|public native int GetTrainzBuild(void)}}&lt;br /&gt;
;Parameters;&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Gets the current build number of Trainz. &lt;br /&gt;
;Syntax&lt;br /&gt;
 int build = World.GetTrainzBuild();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the build number you can see in the bottom-right side of the main Trainz menu screen.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzVersion==&lt;br /&gt;
{{MethodHeader|public native float GetTrainzVersion(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The TRS version number.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float version = World.GetTrainzVersion();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the version number of Content manager (for example 4.6). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTriggerList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Trigger|Trigger]][ ] GetTriggerList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trigger objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trigger[] triggers = World.GetTriggerList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
*This method does not return scenery triggers, ie those attached to SceneryWithTrack objects and their descendants.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetVehicleList==&lt;br /&gt;
{{MethodHeader|public obsolete native [[Class Vehicle|Vehicle]][ ] GetVehicleList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the vehicles in the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Vehicle[] vehicles = World.GetVehicleList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used. Use [[#GetNamedObjectList|GetNamedObjectList]] instead.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherChangeability==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherChangeability(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Changeability_Constants|Weather Changeability Constants]] denoting the variability of weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int variability = World.GetWeatherChangeability();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherType==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherType(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Type_Constants|Weather Type Constants]] denoting the current weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int weather = World.GetWeatherType();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsAssetRestrictionInEffect==&lt;br /&gt;
{{MethodHeader|public native bool IsAssetRestrictionInEffect(string)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether this game world has Asset Restrictions. &lt;br /&gt;
;Syntax&lt;br /&gt;
 bool assetRestrictionsExist = World.IsAssetRestrictionInEffect();&lt;br /&gt;
;Notes&lt;br /&gt;
*Multiplayer Sessions require Asset Restrictions to be in effect to avoid compatibility issues between peers.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsLayerVisible==&lt;br /&gt;
{{MethodHeader|public native bool IsLayerVisible(string layerName)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*layerName = Name of the layer to check&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether the layer is visible&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool isVisible = World.IsLayerVisible(&amp;quot;MyLayer&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadMap==&lt;br /&gt;
{{MethodHeader|public native bool LoadMap([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of map to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadMap(mapKUID) Interface.Print(&amp;quot;Map loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Map load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use World.[[#FindKUID|FindKUID()]] to find the desired route KUID.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadSession==&lt;br /&gt;
{{MethodHeader|public native bool LoadSession([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of session to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadSession(sessionKUID) Interface.Print(&amp;quot;Session loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Session load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use World.[[#FindKUID|FindKUID()]] to find the desired session KUID.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Play2DSound==&lt;br /&gt;
{{MethodHeader|public float Play2DSound([[Class Asset|Asset]] asset, string wave)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Undefined.&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;);        &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;)); &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&amp;quot; sound file from the given asset&#039;s folder.&lt;br /&gt;
*The sound is non directional and can be mono or stereo. &lt;br /&gt;
*This method does not return after the sound has finished playing, it returns with the length of the sound as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PlaySound==&lt;br /&gt;
{{MethodHeader|public native float PlaySound&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt)&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt, bool loop)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
*&#039;&#039;&#039;vol&#039;&#039;&#039; = Volume level to play the sound at (0 to 1)&amp;lt;- These values taken from TRS2019 world.gs file comments&lt;br /&gt;
*&#039;&#039;&#039;near&#039;&#039;&#039; = Distance from the target asset at which the sound will be played at maximum volume.&lt;br /&gt;
*&#039;&#039;&#039;far&#039;&#039;&#039; = Distance from the target asset at which the sound will become inaudible.&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to which the sound will be attached if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;pt&#039;&#039;&#039; = Name of attachment point in the target object if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;loop&#039;&#039;&#039; = (Optional) If true the sound will loop continuously.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Sound length in seconds for Trainz before TS12&lt;br /&gt;
* Undefined for TS12 and TANE&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1000.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&#039;&#039; sound file from the given asset&#039;s folder.&lt;br /&gt;
*If the sound is to be directional a mono sound file is required. &lt;br /&gt;
*This method does not return after the sound has finished playing: it returns as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
*If you want to wait for the sound to complete playing before moving on, wrap the PlaySound() call up in a Sleep() call. &#039;&#039;&#039;Note!&#039;&#039;&#039; This works only in Trainz versions before TS12. For newer versions, TS12 and TANE, you can hard-code the duration of the sound, or store it in the extensions container of the config.txt file.&lt;br /&gt;
*The sound volume will be at a maximum for a camera position at or less than the value of the &#039;&#039;near&#039;&#039; parameter and will reduce with distance until the hearing position reaches &#039;&#039;far&#039;&#039;, when the sound will be inaudible.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCharacter([[Class DriverCharacter|DriverCharacter]] driver)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driver&#039;&#039;&#039; = DriverCharacter to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCharacter(dave);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCommand==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCommand([[Class DriverCommand|DriverCommand]] command)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;command&#039;&#039;&#039; = DriverCommand to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCommand(driverCommand);&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RestartSession==&lt;br /&gt;
{{MethodHeader|public native bool RestartSession()}}&lt;br /&gt;
;Parameters&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RestartSession();&lt;br /&gt;
;Notes&lt;br /&gt;
*Valid in Driver mode only.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetBadWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Bad weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetBadWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCamera==&lt;br /&gt;
{{MethodHeader|public native bool SetCamera([[Class MapObject|MapObject]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Junction|Junction]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Vehicle|Vehicle]] focus, int cameraMode)&amp;lt;br&amp;gt;public native void SetCamera([[Class Train|Train]] focus, int cameraMode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;focus&#039;&#039;&#039; = Object on which the camera is to be focused.&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Mode]] constants defining the view which should be assigned to the camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The first variant returns a boolean to indicate success or failure.&lt;br /&gt;
*Remaining variants do not return a value&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCamera(train.GetVehicles[0],World.CAMERA_TRACKING); // sets the camera to track the first vehicle in the train.&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Junction alias removed in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraAngle==&lt;br /&gt;
{{MethodHeader|public void SetCameraAngle(float yaw, float pitch, float radius)&amp;lt;br&amp;gt;public obsolete void SetCameraAngle(int yaw, int pitch, float radius)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;yaw&#039;&#039;&#039; = Camera rotation in radians (float) or degrees (int), 90 is a direct front view.&lt;br /&gt;
*&#039;&#039;&#039;pitch&#039;&#039;&#039; = Camera angle relative to the horizon in radians (float), or degrees (int), 0 is horizontal, 90 points vertically upwards.&lt;br /&gt;
*&#039;&#039;&#039;radius&#039;&#039;&#039; = Distance in metres to the object in focus.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraAngle(90,0,25); // Sets the camera to a direct frontal view at 25 metres from the currently focused object.&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;Radius&#039;&#039; is measured from the object origin point (0,0,0). If there&#039;s no target object this will be the distance to the ground.&lt;br /&gt;
*Note difference in units of &#039;&#039;yaw&#039;&#039; and &#039;&#039;pitch&#039;&#039; depending in the method signature used.&lt;br /&gt;
*The integer version of this method call is obsolete in TRS19.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraFlags==&lt;br /&gt;
{{MethodHeader|public native void SetCameraFlags(int flags)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039;  integer value defining what the user is permitted to do with the game camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 // User is permitted to select External or Tracking views only.&lt;br /&gt;
    World.SetCameraFlags(World.CAMERA_EXTERNAL | World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use any combination of [[#Camera_Flags|Camera Flags]] and [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraMode==&lt;br /&gt;
{{MethodHeader|public void SetCameraMode(int mode)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = Camera mode to select.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraMode(World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetEditingCamera==&lt;br /&gt;
{{MethodHeader|public void SetEditingCamera([[Class GameObject|GameObject]] actor, bool bIsActorEditingCamera)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;actor&#039;&#039;&#039; = The script who is intended to edit the camera position.&lt;br /&gt;
*&#039;&#039;&#039;bIsActorEditingCamera&#039;&#039;&#039; = True to begin editing, or False to end the editing operation. &lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetEditingCamera(myScript, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*Hints to the caching systems that the camera position is in the process of being changed. This may reduce the amount of streaming that will occur until the change is complete.&lt;br /&gt;
*This is intended for use-cases where the decision to move the camera happens in advance of the actual call to [[#SetCamera|SetCamera()]] or etc., for example when the new camera target needs to be streamed in first.&lt;br /&gt;
*There is no advantage in calling this unless your code then sleeps/waits before undoing the call.&lt;br /&gt;
*It is not required to call this before using SetCamera() etc.&lt;br /&gt;
*A boolean state is stored per actor; multiple calls to enable editing on a single actor do not need to be matched to multiple calls to disable editing.&lt;br /&gt;
*It is counterproductive to call this when transitioning the camera over a short distance (ie. where the source and target locations can see each other). If jumping to a new location, followed by a visual camera transition at the new location, camera editing may be enabled around the target-selection for the jump, and the jump itself, but should be disabled before proceeding with the transition.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameDate==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(int year, int month, int date)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;year&#039;&#039;&#039; = The year to set (1970-2038)&lt;br /&gt;
*&#039;&#039;&#039;month&#039;&#039;&#039; = The month to set (1-12)&lt;br /&gt;
*&#039;&#039;&#039;day&#039;&#039;&#039; = The day to set (1-31)&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(2000, 12, 25);  // sets date to 25 December 2000&lt;br /&gt;
;Notes&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTime==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = new gane time to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(0.5);  // sets time to midnight&lt;br /&gt;
;Notes&lt;br /&gt;
*Game time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday&lt;br /&gt;
*0.25 = 6 p.m.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*0.75 = 6 a.m.&lt;br /&gt;
*1.0 = midday again&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert human readable times to normalised values. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTimeRate==&lt;br /&gt;
{{MethodHeader|public native void SetGameTimeRate(float rate)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;rate&#039;&#039;&#039; = New time rate to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTimeRate(World.TIME_RATE_8X); // sets game time to advance by 8 minutes per minute of real world time.&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Time_Rate_Constants|Time Rate Constants]] to define the parameter.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetGoodWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Good weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGoodWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
*Obsolete in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetGroundDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Ground draw distance in metres.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGroundDrawDistance(1000.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Compatibility warning: Use of this function is not recommended, it may become non-functional in future Trainz versions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetLayerVisible==&lt;br /&gt;
{{MethodHeader|public native void IsLayerVisible(string layerName, bool visible)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*layerName = Name of the layer to check&lt;br /&gt;
*visible = Whether to set the layer visible or not&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.IsLayerVisible(&amp;quot;MyLayer&amp;quot;, False);&lt;br /&gt;
;Notes&lt;br /&gt;
*Show/Hide a route/session layer.&lt;br /&gt;
*In multiplayer, this will only succeed on the server.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in ...?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public obsolete native void SetSceneryDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = unused.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
* Does nothing. Included for script compatibility only.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetTargetObserver==&lt;br /&gt;
{{MethodHeader|public void SetTargetObserver([[Class GameObject|GameObject]] observer)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;observer&#039;&#039;&#039; = The game object to receive targeting messages.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SetTargetObserver(self);&lt;br /&gt;
;Notes&lt;br /&gt;
* It is unlikely a script programmer would ever need to use this method.&lt;br /&gt;
* Causes the specified object to receive &amp;quot;Track&amp;quot;, &amp;quot;LeftClick&amp;quot; messages when a track is clicked. Causes the specified object to receive &amp;quot;Interface-Event&amp;quot;, &amp;quot;Left-Click&amp;quot; messages when a targetable MapObject is clicked. May cause the functionality of a left mouse click to change from what the user is expecting, so should be used with caution. Used in modal scripts to allow the user to indicate a location for train placement, etc. As there is only a single observer at any given time, the script must take care to only call this function when entering placement mode at the user&#039;s request.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWeather==&lt;br /&gt;
{{MethodHeader|public native void SetWeather(int type, int changeability)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;type&#039;&#039;&#039; = Weather conditions as defined by one of the [[#Weather_Type_Constants|Weather Type Constants]].&lt;br /&gt;
*&#039;&#039;&#039;change&#039;&#039;&#039; = Weather variation as defined by one of the [[#Weather_Changeability_Constants|Weather Changeability Constants]].&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_HEAVY_SNOW,World.WEATHER_CHANGEABILITY_EXTREME); // April in Paris.&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWorldEditModeEnabled==&lt;br /&gt;
{{MethodHeader|public native bool SetWorldEditModeEnabled(int editFlags, bool enable)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;editFlags&#039;&#039;&#039; = Bitmask specifying which modes to alter, see PERMIT_EDIT_*&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = Whether to enable or disable the mode&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Whether the change was completely successful&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWorldEditModeEnabled(World.PERMIT_EDIT_TRAINS | World.PERMIT_EDIT_CONSISTS, True); // Enable player editing of trains and consists&lt;br /&gt;
;Notes&lt;br /&gt;
*This does not affect scripts which may alter the world, only the availability of the player world editing tools (i.e, the Surveyor tabs).&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SynchronouslyLoadGameObjectByID==&lt;br /&gt;
{{MethodHeader|public [[Class GameObject|GameObject]] SynchronouslyLoadGameObjectByID([[Class GameObjectID|GameObjectID]] objectID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;objectID&#039;&#039;&#039; = The ID of the object to find.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* The object, if it exists.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject my_object = World.SynchronouslyLoadGameObjectByID(objectID);&lt;br /&gt;
 if (my_object Interface.Print(&amp;quot;Object exists and has been loaded if required&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is usable only by script &#039;thread&#039; functions and will throw an exception if called incorrectly.&lt;br /&gt;
*Added in TRS19&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UpdatePositionToGroundHeight==&lt;br /&gt;
{{MethodHeader|public native bool UpdatePositionToGroundHeight([[Class WorldCoordinate|WorldCoordinate]] position)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; (in, out) = Position object to update with the ground height at it&#039;s location&lt;br /&gt;
;Returned Value&lt;br /&gt;
* True if the ground position was updated&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.UpdatePositionToGroundHeight(position) Interface.Print(&amp;quot;Position was updated&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This updates the input &#039;&#039;position&#039;&#039; object with the ground height at that location.&lt;br /&gt;
*This process may fail if the ground data at the specified location is not currently loaded.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UpdatePositionToSurfaceHeight==&lt;br /&gt;
{{MethodHeader|public native bool UpdatePositionToSurfaceHeight([[Class WorldCoordinate|WorldCoordinate]] position)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; (in, out) = Position object to update with the water height at it&#039;s location&lt;br /&gt;
;Returned Value&lt;br /&gt;
* True if the ground position was updated&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.UpdatePositionToGroundHeight(position) Interface.Print(&amp;quot;Position was updated&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This updates the input &#039;&#039;position&#039;&#039; object with the water height at that location. If no water is present, the position is adjusted to the ground height.&lt;br /&gt;
*This process may fail if the ground data at the specified location is not currently loaded.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCamera==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera([[Class GameObject|GameObject]] target)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to set focus to.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraMode==&lt;br /&gt;
{{MethodHeader|public native void UserSetCameraMode(int mode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Modes]]&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCameraMode(World.CAMERA_ROAMING);  // switches to roaming view if permitted.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method respects the current [[#Camera_Flags|Camera Flag]] settings, disallowing any change which the flags do not permit.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraPosition==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera([[Class WorldCoordinate|WorldCoordinate]] camPos)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;camPos&#039;&#039;&#039; = World coordinates to set camera to&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
* For camera modes which do not need to target specific objects, this allows the camera to be set to an arbitrary world position.&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;Added in TRS19?&amp;lt;/font&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_AssetCategory&amp;diff=26591</id>
		<title>Class AssetCategory</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_AssetCategory&amp;diff=26591"/>
		<updated>2020-12-28T16:22:21Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Created page with &amp;quot;*API Hierarchy **AssetCategory &amp;lt;br&amp;gt; AssetCategory is a static class used to define the types of searchable categories for assets and objects...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**AssetCategory&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
AssetCategory is a static class used to define the types of searchable categories for assets and objects.&lt;br /&gt;
&lt;br /&gt;
Cateogory codes may also be combined to narrow your search by using the semicolon (;) character. For example you can search for grass/tree splines by using &amp;quot;Flora;Spline&amp;quot;. You can also broaden a search to include multiple category lists using the vertical bar (|) character. Each vertical bar acts as an OR operator on the lists. For example you can search for flora or fauna splines using &amp;quot;Spline;Flora|Spline;Fauna&amp;quot;(i.e. *NOT* &amp;quot;Spline;Flora|Fauna&amp;quot; which would match all flora splines, and any fauna tagged object/spline/etc).&lt;br /&gt;
&lt;br /&gt;
Content creators can also add custom category codes to their assets via the category-class tag. Such codes are prefixed with the &#039;#&#039; character (e.g. &amp;quot;#CITY&amp;quot;). These may be used freely to allow you to tag and search for assets which may support a specific 3rd party library, feature, etc.&lt;br /&gt;
&lt;br /&gt;
Note that there may exist other category codes which are not listed here, but use of those is considered unsupported and may break without notice in any future version of Trainz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*These constants can be used to search for assets in the game world via [[Class World#GetNamedObjectList|World.GetNamedObjectList()]]. &lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;AssetCategory.&#039;&#039;, for example:&lt;br /&gt;
 AsyncObjectSearchResult search_result = World.GetNamedObjectList(AssetCategory.Locomotive);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Map Object, Track, and Spline Constants===&lt;br /&gt;
----&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define string Bridge = &amp;quot;BRG&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Building = &amp;quot;BD&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Crossing = &amp;quot;FIXD;CROS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Fauna = &amp;quot;FA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string FixedTrack = &amp;quot;FIXD&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Flora = &amp;quot;FL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Industry = &amp;quot;IND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string InterlockingTower = &amp;quot;IT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Junction = &amp;quot;TO;?WX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Mesh = &amp;quot;CMP;MESH&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string People = &amp;quot;PP&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Road = &amp;quot;RD&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Scenery = &amp;quot;SY&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string SceneryWithTrack = &amp;quot;SWT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Signal = &amp;quot;TO;?WA&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Spline = &amp;quot;SPLN&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Track = &amp;quot;TK&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Trackmark = &amp;quot;?WM&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrackBridge = &amp;quot;TK;BRG&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrackTunnel = &amp;quot;TK;TUN&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrackObject = &amp;quot;TO&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Trigger = &amp;quot;?WT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Tunnel = &amp;quot;TUN&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Turntable = &amp;quot;FIXD;TURN&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string RoadVehicle = &amp;quot;VE&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Train Category Constants===&lt;br /&gt;
----&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define string Caboose = &amp;quot;TR;TV;CAB&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Consist = &amp;quot;CON&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Locomotive = &amp;quot;TR;TV;LOCO&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string MailTrainCar = &amp;quot;TR;TV;MAIL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string MonorailVehicle = &amp;quot;TR;TV;MNR&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string PassengerTrainCar = &amp;quot;TR;TV;PAX&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string RollingStock = &amp;quot;TR;TV;ROLL&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Tram = &amp;quot;TR;TV;TRM&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrainCar = &amp;quot;TR;TV&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrainCarDiesel = &amp;quot;TR;TV;DIES&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrainCarElectric = &amp;quot;TR;TV;ELEC&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrainCarSteam = &amp;quot;TR;TV;STEM&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrainCarTender = &amp;quot;TR;TV;TEND&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrainCarComponent = &amp;quot;TR;CMP&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TrainEngine = &amp;quot;TR;CMP;ESPC&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Route and Session Category Constants===&lt;br /&gt;
----&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define string Region = &amp;quot;REGN&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Route = &amp;quot;RT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string SaveGame = &amp;quot;SG&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string Session = &amp;quot;SS&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string SessionArcade = &amp;quot;SS;ARCD&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string SessionTutorial = &amp;quot;SS;TUT&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|public define string TestTrackTest= &amp;quot;TC&amp;quot;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26590</id>
		<title>TrainzScript Library Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Library_Reference&amp;diff=26590"/>
		<updated>2020-12-28T16:01:36Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add AssetCategory&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is a list of all classes provided by Auran for use with the Trainz game runtime environment. Some of these classes may not be available from other runtime environments. Please see the [[TrainzScript Language Reference]] for a list of the &amp;quot;core&amp;quot; TrainzScript classes that are present in all runtime environments. This list may not be complete, but will be extended in future.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Classes marked with an asterisk have no parent class.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*[[class AssetCategory|AssetCategory]] *&lt;br /&gt;
*[[class GSObject|GSObject]] *&lt;br /&gt;
**[[class Asset|Asset]]&lt;br /&gt;
**[[class DLCInfo|DLCInfo]]&lt;br /&gt;
**[[class GameObjectID|GameObjectID]]&lt;br /&gt;
**[[class GameObject|GameObject]]&lt;br /&gt;
***[[class AsyncObjectSearchResult|AsyncObjectSearchResult]]&lt;br /&gt;
***[[class AsyncTrainzAssetSearchObject|AsyncTrainzAssetSearchObject]]&lt;br /&gt;
***[[class Browser|Browser]]&lt;br /&gt;
***[[class BrowserInterface|BrowserInterface]]&lt;br /&gt;
***[[class CabinControl|CabinControl]]&lt;br /&gt;
***[[class ConstructorsBase|ConstructorsBase]]&lt;br /&gt;
****[[class Constructors|Constructors]]&lt;br /&gt;
***[[class DLCStore|DLCStore]]&lt;br /&gt;
***[[class DriverCommand|DriverCommand]]&lt;br /&gt;
***[[class DriverCommands|DriverCommands]]&lt;br /&gt;
***[[class HTMLPropertyHandler|HTMLProprtyHandler]]&lt;br /&gt;
***[[class Interface|Interface]]&lt;br /&gt;
***[[class InterlockingTowerPath|InterlockingTowerPath]]&lt;br /&gt;
***[[class JunctionBaseGameObject|JunctionBaseGameObject]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
***[[class NavPoints|NavPoints]]&lt;br /&gt;
***[[class ChatChannel|ChatChannel]]&lt;br /&gt;
***[[class OnlineAccess|OnlineAccess]]&lt;br /&gt;
***[[class OnlineGroup|OnlineGroup]]&lt;br /&gt;
***[[class Track|Track]]&lt;br /&gt;
***[[class TrackCircuitBlock|TrackCircuitBlock]]&lt;br /&gt;
***[[class Train|Train]]&lt;br /&gt;
***[[class TrainzAssetSearch|TrainzAssetSearch]]&lt;br /&gt;
***[[class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[class GameplayMenuBase|GameplayMenuBase]]&lt;br /&gt;
*****[[class GameplayMenu|GameplayMenu]]&lt;br /&gt;
*****[[class GameplayMenuMobile|GameplayMenuMobile]]&lt;br /&gt;
****[[class Library|Library]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class OAChat|OAChat]]&lt;br /&gt;
*****[[class Servlet|Servlet]]&lt;br /&gt;
*****[[class SessionVariables|SessionVariables]]&lt;br /&gt;
*****[[class WaybillManager|WaybillManager]]&lt;br /&gt;
****[[class MeshObject|MeshObject]] (Additional parent class: [[class PropertyObject|PropertyObject]] *)&lt;br /&gt;
*****[[class Bogey|Bogey]]&lt;br /&gt;
*****[[class Cabin|Cabin]]&lt;br /&gt;
*****[[class MapObject|MapObject]]&lt;br /&gt;
******[[class InterlockingTower|InterlockingTower]]&lt;br /&gt;
******[[class SceneryWithTrack|SceneryWithTrack]]&lt;br /&gt;
*******[[class Buildable|Buildable]]&lt;br /&gt;
********[[class Industry|Industry]]&lt;br /&gt;
*********[[class BaseIndustry|BaseIndustry]]&lt;br /&gt;
**********[[class GenericPassengerStation|GenericPassengerStation]]&lt;br /&gt;
*********[[class BasePortal|BasePortal]]&lt;br /&gt;
*********[[class GenericIndustry|GenericIndustry]]&lt;br /&gt;
*******[[class Crossing|Crossing]]&lt;br /&gt;
*******[[Class_Turntable|TurnTable]]&lt;br /&gt;
******[[class Trackside|Trackside]]&lt;br /&gt;
*******[[class CarSignal|CarSignal]]&lt;br /&gt;
*******[[class Junction|Junction]] (Additional parent class: [[class JunctionBase|JunctionBase]] *)&lt;br /&gt;
*******[[class Signal|Signal]]&lt;br /&gt;
*******[[class TrackMark|TrackMark]]&lt;br /&gt;
*******[[class Trigger|Trigger]]&lt;br /&gt;
*******[[class Vehicle|Vehicle]]&lt;br /&gt;
********[[class Locomotive|Locomotive]]&lt;br /&gt;
****[[class ModulScript|ModulScript]]&lt;br /&gt;
*****[[class DriverCharacter|DriverCharacter]]&lt;br /&gt;
****[[class ScenarioBehavior|ScenarioBehavior]]&lt;br /&gt;
*****[[class ConditionalScenarioBehavior|ConditionalScenarioBehavior]]&lt;br /&gt;
*****[[class ScenarioBehaviorTemplate|ScenarioBehaviorTemplate]]&lt;br /&gt;
***[[class TrainzScriptBase|TrainzScriptBase]]&lt;br /&gt;
****[[class World|World]]&lt;br /&gt;
***[[class World1|World1]]&lt;br /&gt;
**[[class HTMLBuffer|HTMLBuffer]]&lt;br /&gt;
**[[class IndustryTrainController|IndustryTrainController]]&lt;br /&gt;
**[[class KUID|KUID]]&lt;br /&gt;
**[[class KUIDList|KUIDList]]&lt;br /&gt;
**[[class LoadingReport|LoadingReport]]&lt;br /&gt;
**[[class Menu|Menu]]&lt;br /&gt;
**[[class Permit|Permit]]&lt;br /&gt;
**[[class ProductFilter|ProductFilter]]&lt;br /&gt;
**[[class ProductQueue|ProductQueue]]&lt;br /&gt;
**[[class SecurityToken|SecurityToken]]&lt;br /&gt;
**[[class Soup|Soup]]&lt;br /&gt;
**[[class StringTable|StringTable]]&lt;br /&gt;
**[[class TrackPathDisplay|TrackPathDisplay]]&lt;br /&gt;
**[[class TrainTimeTable|TrainTimeTable]]&lt;br /&gt;
*[[class GSTrackSearch|GSTrackSearch]] *&lt;br /&gt;
*[[class Math|Math]] *&lt;br /&gt;
*[[class Router|Router]] *&lt;br /&gt;
*[[class Str|Str]] *&lt;br /&gt;
*[[class TrainUtil|TrainUtil]] *&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26589</id>
		<title>Class World</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26589"/>
		<updated>2020-12-28T15:10:07Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add reference links to other classes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**World&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*World is a static class used to access various aspects of the Trainz environment.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;World.&#039;&#039;, for example:&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_LIGHT_SNOW,World.WEATHER_CHANGEABILITY_PERIODIC);&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera View Modes===&lt;br /&gt;
----&lt;br /&gt;
*These values can be used either to choose the current camera viewing mode through World.[[#SetCameraMode|SetCameraMode()]], or to restrict certain camera modes from being accessed through methods such as World.[[#SetCamera|SetCamera()]].&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_INTERNAL = 1||Internal cabin camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_EXTERNAL = 2||External train camera view&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_TRACKING = 4||External tracking camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_ROAMING = 128||Roaming camera view.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera Flags===&lt;br /&gt;
----&lt;br /&gt;
*These flags are used in addition to the Camera Mode Flags to allow or disallow specific camera actions. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_SWITCH_VIEWS = 8||User permitted to swap between the camera views.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_VEHICLES = 16||User permitted to swap vehicles within the current train.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_TRAINS = 32||User permitted to swap to other trains which are in the consist menu.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_LOCKED = 64||User is NOT permitted to adjust camera (i.e. zoom, pan etc.).&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_NORMAL = * ||Normal camera mode where everything is permitted.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|&amp;lt;sup&amp;gt;* NOTE: CAMERA_NORMAL = CAMERA_INTERNAL | CAMERA_EXTERNAL | CAMERA_TRACKING | CAMERA_SWITCH_VIEWS | CAMERA_SWITCH_VEHICLES | CAMERA_SWITCH_TRAINS&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the current state of the weather in Trainz. &lt;br /&gt;
*A variety of weather conditions are supported and can be changed by using one of these values with the World.[[#SetWeather|SetWeather()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_TYPE_CLEAR = 0||Clear weather, no clouds, rain or snow.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_CLOUDY = 1||Cloudy weather, no rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_DRIZZLE = 2||Drizzle, light rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_RAIN = 3||Rainy weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_STORMY = 4||Stormy weather that includes lightning and thunder.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_LIGHT_SNOW = 5||Snowing lightly.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_MEDIUM_SNOW = 6||Medium level snow fall.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_HEAVY_SNOW = 7||Heavy snow fall.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Changeability Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the changeability settings for the weather. &lt;br /&gt;
*Weather changeability refers to variability of weather conditions rather than to a specific weather type.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_CHANGEABILITY_NONE = 0||Weather remains static.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_PERIODIC = 1||Periodic changes in weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_EXTREME = 2||Extreme and frequent changes in weather. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Values===&lt;br /&gt;
----&lt;br /&gt;
*Time constants defined in seconds.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define float TIME_SECOND = 1.0f||One second.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_MINUTE = TIME_SECOND * 60.0f||One minute, 60.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_HOUR = TIME_MINUTE * 60.0f||One hour, 60.0 minutes, 3600.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_DAY = TIME_HOUR * 24.0f||One day, 24 hours, 1440.0 minutes, 86400.0 seconds.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Rate Constants===&lt;br /&gt;
----&lt;br /&gt;
*Values that define the time rates relative to normal time. &lt;br /&gt;
*These constants can be used to set the time rate that Trainz runs out through the World.[[#SetGameTimeRate|SetGameTimeRate()]] method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  TIME_RATE_1X = 0||Real time (i.e. time in Trainz passes at the same rate as in the real world)&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_2X = 1||Time passes at twice normal speed.&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_4X = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_8X = 3||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_16X = 4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_32X = 5||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_60X = 6||&lt;br /&gt;
|-&lt;br /&gt;
| public define int TIME_RATE_120X = 7||&lt;br /&gt;
|-&lt;br /&gt;
| public define int TIME_RATE_240X = 8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_360X = 9||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_480X = 10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_720X = 11||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_960X = 12||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1200X = 13||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1440X = 14||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Trainz Modules===&lt;br /&gt;
----&lt;br /&gt;
*Trainz module mode constants. &lt;br /&gt;
*These values define the various module environments that Trainz can be in. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  NO_MODULE = 0||Trainz not running in a module.&lt;br /&gt;
|-&lt;br /&gt;
|public define int SURVEYOR_MODULE = 1||Trainz is currently running in Surveyor.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DRIVER_MODULE = 2||Trainz is currently running in Driver.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
* [[TrainzScript Message Reference]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Camera Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Interface Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[ModuleInit Message]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]] AddDriverCharacter([[Class Asset|Asset]] driverCharacterAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCharacterAsset&#039;&#039;&#039; = Asset containing character to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCharacter if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter Casey = World.AddDriverCharacter(CaseyJones);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] AddDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.AddDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateBehavior==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]] CreateBehavior([[Class KUID|KUID]] kuid, [[Class Soup|Soup]] initialProperties)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of scenario.&lt;br /&gt;
&#039;&#039;&#039;initialProperties&#039;&#039;&#039; = Soup object containing initial properties for scenario.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the ScenarioBehavior created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior scenario = World.CreateBehavior(scenarioAsset, scenarioSoup);&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned ScenarioBehavior object may be ended by releasing all references to it (resetting all references to null).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrain==&lt;br /&gt;
{{MethodHeader|public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, string trackmarkName, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class TrackMark|TrackMark]] trackmark, bool direction)&amp;lt;br&amp;gt;public native [[Class Train|Train]] CreateTrain([[Class KUID|KUID]][ ] consist, [[Class Buildable|Buildable]] buildable, string trackName, float position, bool direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;consist&#039;&#039;&#039; = An array of vehicle KUIDs used to describe the required Train object.&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;buildable&#039;&#039;&#039; = Buildable on which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;trackName&#039;&#039;&#039; = Name of track within Buildable object.&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; = Distance at which the Train is to be placed relative to the start of the track.&lt;br /&gt;
*&#039;&#039;&#039;trackmark&#039;&#039;&#039; = Reference to Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = Orientation of Train relative to direction of track or trackmark.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the Train created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = World.CreateTrain(consist, buildable, &amp;quot;Track 1&amp;quot;, 10.0, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*These methods create a train from a list of vehicles in a consist array.&lt;br /&gt;
*Depending on the variant of the method used, the train can be created at a Trackmark, specified by name or reference, or at a Buildable or Industry object.&lt;br /&gt;
*It is the responsibility of the script programmer to ensure that sufficient track exists at the given location to allow the train to be created.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteTrain==&lt;br /&gt;
{{MethodHeader|public native void DeleteTrain([[Class Train|Train]] train)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = train to be deleted from map.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteTrain(flyingScotsman);&lt;br /&gt;
;Notes&lt;br /&gt;
*Once a train has been deleted, care should be taken to avoid using its reference.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteVehicle==&lt;br /&gt;
{{MethodHeader|public native void DeleteVehicle([[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = vehicle to be deleted from its train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteVehicle(vehicles[vehicles.size()-1]);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use Train.GetVehicles() to obtain an array of vehicles for a given train.&lt;br /&gt;
*Use Vehicle.GetMyTrain() to obtain a train reference for a given vehicle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindAsset==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]] FindAsset([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of Asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Given a valid KUID parameter, this method return an Asset reference if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset asset = World.FindAsset(kuid);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also Asset.FindAsset()&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindDriverCommand==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]] FindDriverCommand([[Class Asset|Asset]] driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.FindDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAssetList==&lt;br /&gt;
{{MethodHeader|public native [[Class Asset|Asset]][ ] GetAssetList(string kind)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kind&#039;&#039;&#039; = String representing the Kind of asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of all assets of the given &#039;&#039;kind&#039;&#039;&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset[] Libraries = World.GetAssetList(&amp;quot;Library&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*All installed assets of the given &#039;&#039;kind&#039;&#039; are returned, irrespective of whether or not they are in use on the current map.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public native float GetBadWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Bad weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetBadWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBehaviors==&lt;br /&gt;
{{MethodHeader|public native [[Class ScenarioBehavior|ScenarioBehavior]][ ] GetBehaviors(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of top-level behaviors or rules on the currently loaded route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior[] rules = World.GetBehaviors();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionX==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPositionX(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*X Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float X = World.GetCameraPositionX();&lt;br /&gt;
*Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionY==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPositionY(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Y Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Y = World.GetCameraPositionY();&lt;br /&gt;
*Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionZ==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPositionZ(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Z Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Z = World.GetCameraPositionZ();&lt;br /&gt;
*Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentModule==&lt;br /&gt;
{{MethodHeader|public native int GetCurrentModule(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An integer representing the current Trainz module.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int module = World.GetCurrentModule();&lt;br /&gt;
;Notes&lt;br /&gt;
* See [[#Trainz Modules|Trainz Modules]] for details of the constants associated with this method. &lt;br /&gt;
* See [[ModuleInit Message]] for further details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCharacterList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCharacter|DriverCharacter]][ ] GetDriverCharacterList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCharacter objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter[] drivers = World.GetDriverCharacterList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCommandList==&lt;br /&gt;
{{MethodHeader|public native [[Class DriverCommand|DriverCommand]][ ] GetDriverCommandList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCommand objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand[] commands = World.GetDriverCommandList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameTime==&lt;br /&gt;
{{MethodHeader|public native float GetGameTime(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Now = World.GetGameTime();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert the normalised values to human readable times.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public native float GetGoodWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Good weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGoodWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public native float GetGroundDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Ground draw distance in metres.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGroundDrawDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetIndustryList==&lt;br /&gt;
{{MethodHeader|public native [[Class GameObject|GameObject]][ ] GetIndustryList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the Industry objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject[] Industries = World.GetIndustryList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetJunctionList==&lt;br /&gt;
{{MethodHeader|public native [[Class Junction|Junction]][ ] GetJunctionList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackside junction objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Junction[] junctions = World.GetJunctionList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
*Junction objects attached to fixed track junctions are not returned by this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLibrary==&lt;br /&gt;
{{MethodHeader|public native [[Class Library|Library]] GetLibrary([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of script library asset to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the script library asset if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Library codelib = World.GetLibrary(LibraryKUID);&lt;br /&gt;
;Notes&lt;br /&gt;
*The [[Class Library|Library]] asset is initialised when this method is first called in a session.&lt;br /&gt;
*Since only one instance can exist, subsequent calls return a reference to the existing Library object.&lt;br /&gt;
*See [[Class Library|Library]] for notes on how to use this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public native float GetSceneryDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Undefined.&lt;br /&gt;
;Notes&lt;br /&gt;
*Included for legacy script compatibility only. Has no effect.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSeconds==&lt;br /&gt;
{{MethodHeader|public native float GetSeconds(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current value of a floating point number incrementing once per second in real time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float start = World.GetSeconds();&lt;br /&gt;
 // do stuff&lt;br /&gt;
 float finish = World.GetSeconds();&lt;br /&gt;
 float period = finish - start;&lt;br /&gt;
;Notes&lt;br /&gt;
*Each call will return a float value containing the current value of an internal counter.&lt;br /&gt;
*Subtracting a later value from a value saved at an earlier call will enable the delay between the two calls to be established.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSignalList==&lt;br /&gt;
{{MethodHeader|public native [[Class Signal|Signal]][ ] GetSignalList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the signal objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Signal[] signals = World.GetSignalList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStringTable==&lt;br /&gt;
{{MethodHeader|public native [[Class StringTable|StringTable]] GetStringTable(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The StringTable for the current session.&lt;br /&gt;
;Syntax&lt;br /&gt;
 StringTable data = World.GetStringTable();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsist==&lt;br /&gt;
{{MethodHeader|public native [[Class Soup|Soup]] GetSurveyorSavedConsistList(string name)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; = Name of the consist to retrieve.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a Soup definition of the named consist if it exists, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Soup consist = World.GetSurveyorSavedConsist(&amp;quot;Brighton Belle&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Remember that the returned data is in a Soup format, which is not the same thing as a Train. &lt;br /&gt;
*TrainUtil.CreateTrainFormSoup() can be used to create a train from the returned Soup.&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsistList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetSurveyorSavedConsistList()}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of names of all the saved consist objects in Surveyor.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] consists = World.GetSurveyorSavedConsistList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrackmarkList==&lt;br /&gt;
{{MethodHeader|public native [[Class TrackMark|TrackMark]][ ] GetTrackmarkList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackmark objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trackmark[] trackmarks = World.GetTrackmarkList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainList==&lt;br /&gt;
{{MethodHeader|public native [[Class Train|Train]][ ] GetTrainList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trains for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train[] trains = World.GetTrainList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzBuild==&lt;br /&gt;
{{MethodHeader|public native int GetTrainzBuild(void)}}&lt;br /&gt;
;Parameters;&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Gets the current build number of Trainz. &lt;br /&gt;
;Syntax&lt;br /&gt;
 int build = World.GetTrainzBuild();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the build number you can see in the bottom-right side of the main Trainz menu screen.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzVersion==&lt;br /&gt;
{{MethodHeader|public native float GetTrainzVersion(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The TRS version number.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float version = World.GetTrainzVersion();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the version number of Content manager (for example 4.6). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTriggerList==&lt;br /&gt;
{{MethodHeader|public native [[Class Trigger|Trigger]][ ] GetTriggerList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trigger objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trigger[] triggers = World.GetTriggerList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
*This method does not return scenery triggers, ie those attached to SceneryWithTrack objects and their descendants.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetVehicleList==&lt;br /&gt;
{{MethodHeader|public native [[Class Vehicle|Vehicle]][ ] GetVehicleList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the vehicles in the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Vehicle[] vehicles = World.GetVehicleList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherChangeability==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherChangeability(void)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Changeability_Constants|Weather Changeability Constants]] denoting the variability of weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int variability = World.GetWeatherChangeability();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherType==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherType(void)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Type_Constants|Weather Type Constants]] denoting the current weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int weather = World.GetWeatherType();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadMap==&lt;br /&gt;
{{MethodHeader|public native bool LoadMap([[Class KUID|KUID]] kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of map to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadMap(mapKUID) Interface.Print(&amp;quot;Map loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Map load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Play2DSound==&lt;br /&gt;
{{MethodHeader|public float Play2DSound([[Class Asset|Asset]] asset, string wave)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Undefined.&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;);        &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;)); &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&amp;quot; sound file from the given asset&#039;s folder.&lt;br /&gt;
*The sound is non directional and can be mono or stereo. &lt;br /&gt;
*This method does not return after the sound has finished playing, it returns with the length of the sound as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PlaySound==&lt;br /&gt;
{{MethodHeader|public native float PlaySound&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt)&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;([[Class Asset|Asset]] asset, string wave, float vol, float near, float far, [[Class GameObject|GameObject]] target, string pt, bool loop)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
*&#039;&#039;&#039;vol&#039;&#039;&#039; = Volume level to play the sound at (0 to 1)&amp;lt;- These values taken from TRS2019 world.gs file comments&lt;br /&gt;
*&#039;&#039;&#039;near&#039;&#039;&#039; = Distance from the target asset at which the sound will be played at maximum volume.&lt;br /&gt;
*&#039;&#039;&#039;far&#039;&#039;&#039; = Distance from the target asset at which the sound will become inaudible.&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to which the sound will be attached if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;pt&#039;&#039;&#039; = Name of attachment point in the target object if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;loop&#039;&#039;&#039; = (Optional) If true the sound will loop continuously.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Sound length in seconds for Trainz before TS12&lt;br /&gt;
* Undefined for TS12 and TANE&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1000.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&#039;&#039; sound file from the given asset&#039;s folder.&lt;br /&gt;
*If the sound is to be directional a mono sound file is required. &lt;br /&gt;
*This method does not return after the sound has finished playing: it returns as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
*If you want to wait for the sound to complete playing before moving on, wrap the PlaySound() call up in a Sleep() call. &#039;&#039;&#039;Note!&#039;&#039;&#039; This works only in Trainz versions before TS12. For newer versions, TS12 and TANE, you can hard-code the duration of the sound, or store it in the extensions container of the config.txt file.&lt;br /&gt;
*The sound volume will be at a maximum for a camera position at or less than the value of the &#039;&#039;near&#039;&#039; parameter and will reduce with distance until the hearing position reaches &#039;&#039;far&#039;&#039;, when the sound will be inaudible.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCharacter([[Class DriverCharacter|DriverCharacter]] driver)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driver&#039;&#039;&#039; = DriverCharacter to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCharacter(dave);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCommand==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCommand([[Class DriverCommand|DriverCommand]] command)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;command&#039;&#039;&#039; = DriverCommand to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCommand(driverCommand);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public native void SetBadWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Bad weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetBadWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCamera==&lt;br /&gt;
{{MethodHeader|public native bool SetCamera([[Class MapObject|MapObject]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Junction|Junction]] focus)&amp;lt;br&amp;gt;public native void SetCamera([[Class Vehicle|Vehicle]] focus, int cameraMode)&amp;lt;br&amp;gt;public native void SetCamera([[Class Train|Train]] focus, int cameraMode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;focus&#039;&#039;&#039; = Object on which the camera is to be focused.&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Mode]] constants defining the view which should be assigned to the camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The first variant returns a boolean to indicate success or failure.&lt;br /&gt;
*Remaining variants do not return a value&lt;br /&gt;
&#039;Syntax&lt;br /&gt;
 World.SetCamera(train.GetVehicles[0],World.CAMERA_TRACKING); // sets the camera to track the first vehicle in the train.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraAngle==&lt;br /&gt;
{{MethodHeader|public void SetCameraAngle(int yaw, int pitch, float radius)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;yaw&#039;&#039;&#039; = Camera rotation in degrees, 90 is a direct front view.&lt;br /&gt;
*&#039;&#039;&#039;pitch&#039;&#039;&#039; = Camera angle relative to the horizon, 0 is horizontal, 90 points vertically upwards.&lt;br /&gt;
*&#039;&#039;&#039;radius&#039;&#039;&#039; = Distance in metres to the object in focus.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraAngle(90,0,25); // Sets the camera to a direct frontal view at 25 metres from the currently focused object.&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;Radius&#039;&#039; is measured from the object origin point (0,0,0).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraFlags==&lt;br /&gt;
{{MethodHeader|public native void SetCameraFlags(int flags)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039;  integer value defining what the user is permitted to do with the game camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 // User is permitted to select External or Tracking views only.&lt;br /&gt;
    World.SetCameraFlags(World.CAMERA_EXTERNAL | World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use any combination of [[#Camera_Flags|Camera Flags]] and [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraMode==&lt;br /&gt;
{{MethodHeader|public void SetCameraMode(int mode)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = Camera mode to select.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraMode(World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTime==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = new gane time to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(0.5);  // sets time to midnight&lt;br /&gt;
;Notes&lt;br /&gt;
*Game time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert human readable times to normalised values. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTimeRate==&lt;br /&gt;
{{MethodHeader|public native void SetGameTimeRate(float rate)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;rate&#039;&#039;&#039; = New time rate to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTimeRate(World.TIME_RATE_8X); // sets game time to advance by 8 minutes per minute of real world time.&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Time_Rate_Constants|Time Rate Constants]] to define the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public native void SetGoodWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Good weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGoodWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public native void SetGroundDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Ground draw distance in metres.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGroundDrawDistance(1000.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Compatibility warning: Use of this function is not recommended, it may become non-functional in future Trainz versions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public native void SetSceneryDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = unused.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
* Does nothing. Included for script compatibility only.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetTargetObserver==&lt;br /&gt;
{{MethodHeader|public void SetTargetObserver([[Class GameObject|GameObject]] observer)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;observer&#039;&#039;&#039; = The game object to receive targeting messages.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SetTargetObserver(self);&lt;br /&gt;
;Notes&lt;br /&gt;
* Causes the specified object to receive &amp;quot;Track&amp;quot;, &amp;quot;LeftClick&amp;quot; messages when a track is clicked. Causes the specified object to receive &amp;quot;Interface-Event&amp;quot;, &amp;quot;Left-Click&amp;quot; messages when a targetable MapObject is clicked. May cause the functionality of a left mouse click to change from what the user is expecting, so should be used with caution. Used in modal scripts to allow the user to indicate a location for train placement, etc. As there is only a single observer at any given time, the script must take care to only call this function when entering placement mode at the user&#039;s request.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWeather==&lt;br /&gt;
{{MethodHeader|public native void SetWeather(int type, int changeability)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;type&#039;&#039;&#039; = Weather conditions as defined by one of the [[#Weather_Type_Constants|Weather Type Constants]].&lt;br /&gt;
*&#039;&#039;&#039;change&#039;&#039;&#039; = Weather variation as defined by one of the [[#Weather_Changeability_Constants|Weather Changeability Constants]].&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_HEAVY_SNOW,World.WEATHER_CHANGEABILITY_EXTREME); // April in Paris.&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCamera==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera([[Class GameObject|GameObject]] target)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to set focus to.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraMode==&lt;br /&gt;
{{MethodHeader|public native void UserSetCameraMode(int mode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Modes]]&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCameraMode(World.CAMERA_ROAMING);  // switches to roaming view if permitted.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method respects the current [[#Camera_Flags|Camera Flag]] settings, disallowing any change which the flags do not permit.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26588</id>
		<title>Class TrainUtil</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_TrainUtil&amp;diff=26588"/>
		<updated>2020-12-28T14:57:28Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add reference links to other classes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Language Reference|API Hierarchy]]&lt;br /&gt;
**TrainUtil&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*TrainUtil is a static utility class containing a miscellany of methods.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AlreadyThereStr==&lt;br /&gt;
{{MethodHeader|public bool AlreadyThereStr(string[ ] target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Array of strings to search.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Boolean indicating whether or not the string &#039;&#039;search&#039;&#039; exists in the &#039;&#039;target&#039;&#039; array.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] target = Str.Tokens(&amp;quot;one two three&amp;quot;);&lt;br /&gt;
 bool found = TrainUtil.AlreadyThereStr(target,&amp;quot;four&amp;quot;);    // the result will be false&lt;br /&gt;
;Notes&lt;br /&gt;
*As is usual in Trainzscript string methods the search is case sensitive.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreInTrain==&lt;br /&gt;
{{MethodHeader|public bool AreInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]][ ] vehicles)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train to search.&lt;br /&gt;
*&#039;&#039;&#039;vehicles&#039;&#039;&#039; = Array of vehicle to look for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if all of the vehicles in the array are found in the train, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool allPresent = TrainUtil.AreInTrain(train,vehicles);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#IsInTrain|IsInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CompareStrLists==&lt;br /&gt;
{{MethodHeader|public bool CompareStrLists(string[ ] list1, string[ ] list2)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;list1,list2&#039;&#039;&#039; = String arrays.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the lists are identical, same strings in each index position, same total count. False otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool identical = TrainUtil.CompareStrLists(address1,address2);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrainFromSoup==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] CreateTrainFromSoup([[Class Soup|Soup]] trainSoup, string trackmarkName, bool direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;trainSoup&#039;&#039;&#039; = Consist definition in the form returned by [[Class World#GetSurveyorSavedConsist|World.GetSurveyorSavedConsist()]].&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of the trackmark where the train is to be placed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = True denotes that the train direction should match that of the trackmark.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly created train if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = TrainUtil.CreateTrainFromSoup(BrightonBelle,&amp;quot;Victoria Station&amp;quot;,true);&lt;br /&gt;
;Notes&lt;br /&gt;
*It is the script programmer&#039;s responibility to ensure that sufficient track exists.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoCoupleUp==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoCoupleUp([[Class Train|Train]] train, [[Class Train|Train]] coupleTo)}}&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = First train.&lt;br /&gt;
*&#039;&#039;&#039;coupleTo&#039;&#039;&#039; = Train to couple with.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the newly extended train.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train newTrain = TrainUtil.DoCoupleUp(train, newSection);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DoDecouple==&lt;br /&gt;
{{MethodHeader|public [[Class Train|Train]] DoDecouple([[Class Train|Train]] train, int count)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;count&#039;&#039;&#039; = Number of wagons to detach from the rear of the train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the remaining consist (front section) if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 train = TrainUtil.DoDecouple(train,4);  // drop four cars from the rear of the train, &#039;&#039;train&#039;&#039; will be null if this fails.&lt;br /&gt;
;Notes&lt;br /&gt;
*It is assumed that the train is stopped and already in position.&lt;br /&gt;
*The method will wait for the operation to be completed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAfter==&lt;br /&gt;
{{MethodHeader|public string GetAfter(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the right of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetAfter(&amp;quot;Afternoon&amp;quot;, &amp;quot;er&amp;quot;);   // result is &amp;quot;noon&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the end of the string and works backwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring after that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetUpTo==&lt;br /&gt;
{{MethodHeader|public string GetUpTo(string target, string search)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;search&#039;&#039;&#039; = String containing delimiter characters.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Substring of &#039;&#039;target&#039;&#039; to the left of the characters in &#039;&#039;search&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string result = TrainUtil.GetUpTo(&amp;quot;Before noon&amp;quot;,&amp;quot; no&amp;quot;);   // result is &amp;quot;Before&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*The method starts at the beginning of the string and works forwards until any of the characters in &#039;&#039;search&#039;&#039; are encountered.&lt;br /&gt;
*Once any character in &#039;&#039;search&#039;&#039; is found the substring before that character is returned.&lt;br /&gt;
*If &#039;&#039;search&#039;&#039; is not found the result will be an empty string.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasPrefix==&lt;br /&gt;
{{MethodHeader|public bool HasPrefix(string target, string prefix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;prefix&#039;&#039;&#039; = String containing prefix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; starts with &#039;&#039;prefix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsPrefixed = TrainUtil.HasPrefix(&amp;quot;ante&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HasSufix==&lt;br /&gt;
{{MethodHeader|public bool HasSufix(string target, string suffix)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;suffix&#039;&#039;&#039; = String containing suffix to search for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;target&#039;&#039; ends with &#039;&#039;suffix&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool IsSuffixed = TrainUtil.HasSufix(&amp;quot;dent&amp;quot;,&amp;quot;antecedent&amp;quot;); // returns true&lt;br /&gt;
;Notes&lt;br /&gt;
*This will not work if the method identifier is correctly spelled!&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsInTrain==&lt;br /&gt;
{{MethodHeader|public bool IsInTrain([[Class Train|Train]] train, [[Class Vehicle|Vehicle]] vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train reference.&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = Vehicle reference.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if &#039;&#039;vehicle&#039;&#039; is included in &#039;&#039;train&#039;&#039;, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool brakeVanPresent = TrainUtil.IsInTrain(train,brakeVan); &lt;br /&gt;
;Notes&lt;br /&gt;
*See also [[#AreInTrain|AreInTrain()]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPartTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsPartTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if any part of the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsPartTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsTrainInTrigger==&lt;br /&gt;
{{MethodHeader|public bool IsTrainInTrigger([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, [[Class Trigger|Trigger]] trigger)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;trigger&#039;&#039;&#039; = Reference to the trigger to query.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the train is in the trigger area, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool arrived = TrainUtil.IsTrainInTrigger(me,train,trigger);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RandBool==&lt;br /&gt;
{{MethodHeader|public bool RandBool(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True or false at random.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if(TrainUtil.RandBool()) DoItAtRandom();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RunTurnTable==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void RunTurnTable([[Class GameObject|GameObject]] runningThread, [[Class Train|Train]] train, string turntable)}}&lt;br /&gt;
*&#039;&#039;&#039;runningThread&#039;&#039;&#039; = Thread that called this method.&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Reference to a train.&lt;br /&gt;
*&#039;&#039;&#039;turntable&#039;&#039;&#039; = Name of turntable.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 TrainUtil.RunTurnTable(me,train,&amp;quot;Turntabel 1&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*&amp;lt;font color=red&amp;gt;???????&amp;lt;/font&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==StrSubst==&lt;br /&gt;
{{MethodHeader|public string StrSubst(string target, string remove, string replace)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = String to operate on.&lt;br /&gt;
*&#039;&#039;&#039;remove&#039;&#039;&#039; = Substring to remove.&lt;br /&gt;
*&#039;&#039;&#039;replace&#039;&#039;&#039; = Replacement substring.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns the string target with &#039;&#039;replace&#039;&#039; substituted for &#039;&#039;remove&#039;&#039;, if the method fails an empty string is returned.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string s = &amp;quot;Gnomes are your friends&amp;quot;;&lt;br /&gt;
 s = TrainUtil.StrSubst(s,&amp;quot;friends&amp;quot;,&amp;quot;enemies&amp;quot;);    // returns &amp;quot;Gnomes are your enemies&amp;quot;&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; must exist as a substring of &#039;&#039;target&#039;&#039;, otherwise and empty string will be returned.&lt;br /&gt;
*&#039;&#039;remove&#039;&#039; and &#039;&#039;replace&#039;&#039; do not have to be the same length.&lt;br /&gt;
*Only the first instance of &#039;&#039;remove&#039;&#039; will be substituted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WaitUntilHas==&lt;br /&gt;
&amp;lt;font color=red&amp;gt;Is this still valid?&amp;lt;/font&amp;gt;&lt;br /&gt;
{{MethodHeader|public void WaitUntilHas([[Class Vehicle|Vehicle]] loco, ShuntTrack tracking)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;loco&#039;&#039;&#039; = Consist locomotive.&lt;br /&gt;
*&#039;&#039;&#039;tracking&#039;&#039;&#039; = Tracking array.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
*Waits until all of the vehicles tracked by the tracking array are in the train of the given loco.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26587</id>
		<title>Class World</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=26587"/>
		<updated>2020-12-28T14:56:04Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Change link to library reference, not language reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**World&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*World is a static class used to access various aspects of the Trainz environment.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants are used to define various values and can be used as mnenomics.&lt;br /&gt;
*If accessed from scripts the values must be prefixed &#039;&#039;World.&#039;&#039;, for example:&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_LIGHT_SNOW,World.WEATHER_CHANGEABILITY_PERIODIC);&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera View Modes===&lt;br /&gt;
----&lt;br /&gt;
*These values can be used either to choose the current camera viewing mode through World.SetCameraMode(), or to restrict certain camera modes from being accessed through methods such as World.SetCamera().&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_INTERNAL = 1||Internal cabin camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_EXTERNAL = 2||External train camera view&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_TRACKING = 4||External tracking camera view.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_ROAMING = 128||Roaming camera view.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Camera Flags===&lt;br /&gt;
----&lt;br /&gt;
*These flags are used in addition to the Camera Mode Flags to allow or disallow specific camera actions. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int CAMERA_SWITCH_VIEWS = 8||User permitted to swap between the camera views.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_VEHICLES = 16||User permitted to swap vehicles within the current train.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_SWITCH_TRAINS = 32||User permitted to swap to other trains which are in the consist menu.&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_LOCKED = 64||User is NOT permitted to adjust camera (i.e. zoom, pan etc.).&lt;br /&gt;
|-&lt;br /&gt;
|public define int CAMERA_NORMAL = * ||Normal camera mode where everything is permitted.&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2|&amp;lt;sup&amp;gt;* NOTE: CAMERA_NORMAL = CAMERA_INTERNAL | CAMERA_EXTERNAL | CAMERA_TRACKING | CAMERA_SWITCH_VIEWS | CAMERA_SWITCH_VEHICLES | CAMERA_SWITCH_TRAINS&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Type Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the current state of the weather in Trainz. &lt;br /&gt;
*A variety of weather conditions are supported and can be changed by using one of these values with the World.SetWeather() method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_TYPE_CLEAR = 0||Clear weather, no clouds, rain or snow.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_CLOUDY = 1||Cloudy weather, no rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_DRIZZLE = 2||Drizzle, light rain.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_RAIN = 3||Rainy weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_STORMY = 4||Stormy weather that includes lightning and thunder.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_LIGHT_SNOW = 5||Snowing lightly.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_MEDIUM_SNOW = 6||Medium level snow fall.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_TYPE_HEAVY_SNOW = 7||Heavy snow fall.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weather Changeability Constants===&lt;br /&gt;
----&lt;br /&gt;
*Define the changeability settings for the weather. &lt;br /&gt;
*Weather changeability refers to variability of weather conditions rather than to a specific weather type.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int WEATHER_CHANGEABILITY_NONE = 0||Weather remains static.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_PERIODIC = 1||Periodic changes in weather.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WEATHER_CHANGEABILITY_EXTREME = 2||Extreme and frequent changes in weather. &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Values===&lt;br /&gt;
----&lt;br /&gt;
*Time constants defined in seconds.&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define float TIME_SECOND = 1.0f||One second.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_MINUTE = TIME_SECOND * 60.0f||One minute, 60.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_HOUR = TIME_MINUTE * 60.0f||One hour, 60.0 minutes, 3600.0 seconds.&lt;br /&gt;
|-&lt;br /&gt;
|public define float TIME_DAY = TIME_HOUR * 24.0f||One day, 24 hours, 1440.0 minutes, 86400.0 seconds.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Time Rate Constants===&lt;br /&gt;
----&lt;br /&gt;
*Values that define the time rates relative to normal time. &lt;br /&gt;
*These constants can be used to set the time rate that Trainz runs out through the World.SetGameTimeRate() method. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  TIME_RATE_1X = 0||Real time (i.e. time in Trainz passes at the same rate as in the real world)&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_2X = 1||Time passes at twice normal speed.&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_4X = 2||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_8X = 3||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_16X = 4||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_32X = 5||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_60X = 6||&lt;br /&gt;
|-&lt;br /&gt;
| public define int TIME_RATE_120X = 7||&lt;br /&gt;
|-&lt;br /&gt;
| public define int TIME_RATE_240X = 8||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_360X = 9||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_480X = 10||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_720X = 11||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_960X = 12||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1200X = 13||&lt;br /&gt;
|-&lt;br /&gt;
|public define int TIME_RATE_1440X = 14||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Trainz Modules===&lt;br /&gt;
----&lt;br /&gt;
*Trainz module mode constants. &lt;br /&gt;
*These values define the various module environments that Trainz can be in. &lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  NO_MODULE = 0||Trainz not running in a module.&lt;br /&gt;
|-&lt;br /&gt;
|public define int SURVEYOR_MODULE = 1||Trainz is currently running in Surveyor.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DRIVER_MODULE = 2||Trainz is currently running in Driver.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
* [[TrainzScript Message Reference]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Camera Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[Interface Messages]]&amp;lt;br&amp;gt;&lt;br /&gt;
* [[ModuleInit Message]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native DriverCharacter AddDriverCharacter(Asset driverCharacterAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCharacterAsset&#039;&#039;&#039; = Asset containing character to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCharacter if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter Casey = World.AddDriverCharacter(CaseyJones);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AddDriverCommand==&lt;br /&gt;
{{MethodHeader|public native DriverCommand AddDriverCommand(Asset driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.AddDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior CreateBehavior(KUID kuid, Soup initialProperties)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of scenario.&lt;br /&gt;
&#039;&#039;&#039;initialProperties&#039;&#039;&#039; = Soup object containing initial properties for scenario.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the ScenarioBehavior created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior scenario = World.CreateBehavior(scenarioAsset, scenarioSoup);&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned ScenarioBehavior object may be ended by releasing all references to it (resetting all references to null).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CreateTrain==&lt;br /&gt;
{{MethodHeader|public native Train CreateTrain(KUID[ ] consist, string trackmarkName, bool direction)&amp;lt;br&amp;gt;public native Train CreateTrain(KUID[ ] consist, TrackMark trackmark, bool direction)&amp;lt;br&amp;gt;public native Train CreateTrain(KUID[ ] consist, Buildable buildable, string trackName, float position, bool direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;consist&#039;&#039;&#039; = An array of vehicle KUIDs used to describe the required Train object.&lt;br /&gt;
*&#039;&#039;&#039;trackmarkName&#039;&#039;&#039; = Name of Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;buildable&#039;&#039;&#039; = Buildable on which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;trackName&#039;&#039;&#039; = Name of track within Buildable object.&lt;br /&gt;
*&#039;&#039;&#039;position&#039;&#039;&#039; = Distance at which the Train is to be placed relative to the start of the track.&lt;br /&gt;
*&#039;&#039;&#039;trackmark&#039;&#039;&#039; = Reference to Trackmark at which the consist is to be formed.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = Orientation of Train relative to direction of track or trackmark.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the Train created if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train train = World.CreateTrain(consist, buildable, &amp;quot;Track 1&amp;quot;, 10.0, true);&lt;br /&gt;
;Notes&lt;br /&gt;
*These methods create a train from a list of vehicles in a consist array.&lt;br /&gt;
*Depending on the variant of the method used, the train can be created at a Trackmark, specified by name or reference, or at a Buildable or Industry object.&lt;br /&gt;
*It is the responsibility of the script programmer to ensure that sufficient track exists at the given location to allow the train to be created.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteTrain==&lt;br /&gt;
{{MethodHeader|public native void DeleteTrain(Train train)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = train to be deleted from map.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteTrain(flyingScotsman);&lt;br /&gt;
;Notes&lt;br /&gt;
*Once a train has been deleted, care should be taken to avoid using its reference.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DeleteVehicle==&lt;br /&gt;
{{MethodHeader|public native void DeleteVehicle(Vehicle vehicle)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;vehicle&#039;&#039;&#039; = vehicle to be deleted from its train.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.DeleteVehicle(vehicles[vehicles.size()-1]);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use Train.GetVehicles() to obtain an array of vehicles for a given train.&lt;br /&gt;
*Use Vehicle.GetMyTrain() to obtain a train reference for a given vehicle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindAsset==&lt;br /&gt;
{{MethodHeader|public native Asset FindAsset(KUID kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of Asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Given a valid KUID parameter, this method return an Asset reference if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset asset = World.FindAsset(kuid);&lt;br /&gt;
;Notes&lt;br /&gt;
*See also Asset.FindAsset()&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FindDriverCommand==&lt;br /&gt;
{{MethodHeader|public native DriverCommand FindDriverCommand(Asset driverCommandAsset)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driverCommandAsset&#039;&#039;&#039; = Asset containing command to be added.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Reference to the DriverCommand if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand GoFaster = World.FindDriverCommand(accelerate);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetAssetList==&lt;br /&gt;
{{MethodHeader|public native Asset[ ] GetAssetList(string kind)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kind&#039;&#039;&#039; = String representing the Kind of asset to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of all assets of the given &#039;&#039;kind&#039;&#039;&lt;br /&gt;
;Syntax&lt;br /&gt;
 Asset[] Libraries = World.GetAssetList(&amp;quot;Library&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*All installed assets of the given &#039;&#039;kind&#039;&#039; are returned, irrespective of whether or not they are in use on the current map.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public native float GetBadWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Bad weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetBadWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[ ] GetBehaviors(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A list of top-level behaviors or rules on the currently loaded route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ScenarioBehavior[] rules = World.GetBehaviors();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionX==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPositionX(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*X Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float X = World.GetCameraPositionX();&lt;br /&gt;
*Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionY==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPositionY(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Y Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Y = World.GetCameraPositionY();&lt;br /&gt;
*Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCameraPositionZ==&lt;br /&gt;
{{MethodHeader|public native float GetCameraPositionZ(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Z Coordinate of the current camera position.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Z = World.GetCameraPositionZ();&lt;br /&gt;
*Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetCurrentModule==&lt;br /&gt;
{{MethodHeader|public native int GetCurrentModule(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An integer representing the current Trainz module.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int module = World.GetCurrentModule();&lt;br /&gt;
;Notes&lt;br /&gt;
* See [[#Trainz Modules|Trainz Modules]] for details of the constants associated with this method. &lt;br /&gt;
* See [[ModuleInit Message]] for further details.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCharacterList==&lt;br /&gt;
{{MethodHeader|public native DriverCharacter[ ] GetDriverCharacterList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCharacter objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCharacter[] drivers = World.GetDriverCharacterList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDriverCommandList==&lt;br /&gt;
{{MethodHeader|public native DriverCommand[ ] GetDriverCommandList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of DriverCommand objects installed in the current world.&lt;br /&gt;
;Syntax&lt;br /&gt;
 DriverCommand[] commands = World.GetDriverCommandList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGameTime==&lt;br /&gt;
{{MethodHeader|public native float GetGameTime(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned value&lt;br /&gt;
*Current game time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float Now = World.GetGameTime();&lt;br /&gt;
;Notes&lt;br /&gt;
*The returned time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert the normalised values to human readable times.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public native float GetGoodWeatherFog(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Good weather fog distance as a float in the range 0.0..1.0.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGoodWeatherFog();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public native float GetGroundDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Ground draw distance in metres.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float dist = World.GetGroundDrawDistance();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetIndustryList==&lt;br /&gt;
{{MethodHeader|public native GameObject[ ] GetIndustryList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the Industry objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 GameObject[] Industries = World.GetIndustryList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetJunctionList==&lt;br /&gt;
{{MethodHeader|public native Junction[ ] GetJunctionList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackside junction objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Junction[] junctions = World.GetJunctionList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
*Junction objects attached to fixed track junctions are not returned by this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetLibrary==&lt;br /&gt;
{{MethodHeader|public native Library GetLibrary(KUID kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of script library asset to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the script library asset if successful, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Library codelib = World.GetLibrary(LibraryKUID);&lt;br /&gt;
;Notes&lt;br /&gt;
*The [[Class Library|Library]] asset is initialised when this method is first called in a session.&lt;br /&gt;
*Since only one instance can exist, subsequent calls return a reference to the existing Library object.&lt;br /&gt;
*See [[Class Library|Library]] for notes on how to use this method.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public native float GetSceneryDrawDistance(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Undefined.&lt;br /&gt;
;Notes&lt;br /&gt;
*Included for legacy script compatibility only. Has no effect.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSeconds==&lt;br /&gt;
{{MethodHeader|public native float GetSeconds(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The current value of a floating point number incrementing once per second in real time.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float start = World.GetSeconds();&lt;br /&gt;
 // do stuff&lt;br /&gt;
 float finish = World.GetSeconds();&lt;br /&gt;
 float period = finish - start;&lt;br /&gt;
;Notes&lt;br /&gt;
*Each call will return a float value containing the current value of an internal counter.&lt;br /&gt;
*Subtracting a later value from a value saved at an earlier call will enable the delay between the two calls to be established.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSignalList==&lt;br /&gt;
{{MethodHeader|public native Signal[ ] GetSignalList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the signal objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Signal[] signals = World.GetSignalList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStringTable==&lt;br /&gt;
{{MethodHeader|public native StringTable GetStringTable(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The StringTable for the current session.&lt;br /&gt;
;Syntax&lt;br /&gt;
 StringTable data = World.GetStringTable();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsist==&lt;br /&gt;
{{MethodHeader|public native Soup GetSurveyorSavedConsistList(string name)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; = Name of the consist to retireiev.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a Soup definition of the named consist if it exists, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Soup consist = World.GetSurveyorSavedConsist(&amp;quot;Brighton Belle&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Remember that the returned data is in a Soup format, which is not the same thing as a Train. &lt;br /&gt;
*TrainUtil.CreateTrainFormSoup() can be used to create a train from the returned Soup.&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSurveyorSavedConsistList==&lt;br /&gt;
{{MethodHeader|public native string[ ] GetSurveyorSavedConsistList()}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of names of all the saved consist objects in Surveyor.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string[] consists = World.GetSurveyorSavedConsistList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This method only works in Surveyor.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrackmarkList==&lt;br /&gt;
{{MethodHeader|public native TrackMark[ ] GetTrackmarkList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trackmark objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trackmark[] trackmarks = World.GetTrackmarkList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainList==&lt;br /&gt;
{{MethodHeader|public native Train[ ] GetTrainList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trains for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Train[] trains = World.GetTrainList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzBuild==&lt;br /&gt;
{{MethodHeader|public native int GetTrainzBuild(void)}}&lt;br /&gt;
;Parameters;&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Gets the current build number of Trainz. &lt;br /&gt;
;Syntax&lt;br /&gt;
 int build = World.GetTrainzBuild();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the build number you can see in the bottom-right side of the main Trainz menu screen.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzVersion==&lt;br /&gt;
{{MethodHeader|public native float GetTrainzVersion(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The TRS version number.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float version = World.GetTrainzVersion();&lt;br /&gt;
;Notes&lt;br /&gt;
*The value returned corresponds to the version number of Content manager (for example 4.6). &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTriggerList==&lt;br /&gt;
{{MethodHeader|public native Trigger[ ] GetTriggerList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the trigger objects for the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Trigger[] triggers = World.GetTriggerList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
*This method does not return scenery triggers, ie those attached to SceneryWithTrack objects and their descendants.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetVehicleList==&lt;br /&gt;
{{MethodHeader|public native Vehicle[ ] GetVehicleList(void)}}&lt;br /&gt;
;Parameters &lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of references to all of the vehicles in the current route.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Vehicle[] vehicles = World.GetVehicleList();&lt;br /&gt;
;Notes&lt;br /&gt;
*This function is obsolete and should not be used.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherChangeability==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherChangeability(void)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Changeability_Constants|Weather Changeability Constants]] denoting the variability of weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int variability = World.GetWeatherChangeability();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetWeatherType==&lt;br /&gt;
{{MethodHeader|public native int GetWeatherType(void)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Weather_Type_Constants|Weather Type Constants]] denoting the current weather conditions.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int weather = World.GetWeatherType();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LoadMap==&lt;br /&gt;
{{MethodHeader|public native bool LoadMap(KUID kuid)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;kuid&#039;&#039;&#039; = KUID of map to load.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 if (World.LoadMap(mapKUID) Interface.Print(&amp;quot;Map loaded OK&amp;quot;);&lt;br /&gt;
 else Interface.Print(&amp;quot;Map load failed&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Play2DSound==&lt;br /&gt;
{{MethodHeader|public float Play2DSound(Asset asset, string wave)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Undefined.&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;);        &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.Play2DSound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;)); &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&amp;quot; sound file from the given asset&#039;s folder.&lt;br /&gt;
*The sound is non directional and can be mono or stereo. &lt;br /&gt;
*This method does not return after the sound has finished playing, it returns with the length of the sound as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PlaySound==&lt;br /&gt;
{{MethodHeader|public native float PlaySound&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;(Asset asset, string wave, float vol, float near, float far, GameObject target, string pt)&amp;lt;br&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;(Asset asset, string wave, float vol, float near, float far, GameObject target, string pt, bool loop)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;asset&#039;&#039;&#039; = Asset where the sound file is located.&lt;br /&gt;
*&#039;&#039;&#039;wave&#039;&#039;&#039; = Name of the &#039;&#039;*.wav&#039;&#039; file to be played, a relative path can be included.&lt;br /&gt;
*&#039;&#039;&#039;vol&#039;&#039;&#039; = Volume level to play the sound at (0 to 1)&amp;lt;- These values taken from TRS2019 world.gs file comments&lt;br /&gt;
*&#039;&#039;&#039;near&#039;&#039;&#039; = Distance from the target asset at which the sound will be played at maximum volume.&lt;br /&gt;
*&#039;&#039;&#039;far&#039;&#039;&#039; = Distance from the target asset at which the sound will become inaudible.&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to which the sound will be attached if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;pt&#039;&#039;&#039; = Name of attachment point in the target object if a 3d sound is required, null for 2D.&lt;br /&gt;
*&#039;&#039;&#039;loop&#039;&#039;&#039; = (Optional) If true the sound will loop continuously.&lt;br /&gt;
;Returned Value&lt;br /&gt;
* Sound length in seconds for Trainz before TS12&lt;br /&gt;
* Undefined for TS12 and TANE&lt;br /&gt;
;Syntax&lt;br /&gt;
 // Play the sound and continues script execution.&lt;br /&gt;
    World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
 // Wait until sound has completed before continuing (pre-TS12 only!)&lt;br /&gt;
    Sleep(World.PlaySound(soundAsset,&amp;quot;sounds/allaboard.wav&amp;quot;,1000.0,10.0,100.0,Station,&amp;quot;a.loudspeaker&amp;quot;);     &lt;br /&gt;
;Notes&lt;br /&gt;
*Plays a &#039;&#039;.wav&#039;&#039; sound file from the given asset&#039;s folder.&lt;br /&gt;
*If the sound is to be directional a mono sound file is required. &lt;br /&gt;
*This method does not return after the sound has finished playing: it returns as soon as it is called. &lt;br /&gt;
*This means your code will keep on executing while Trainz is playing the sound.&lt;br /&gt;
*If you want to wait for the sound to complete playing before moving on, wrap the PlaySound() call up in a Sleep() call. &#039;&#039;&#039;Note!&#039;&#039;&#039; This works only in Trainz versions before TS12. For newer versions, TS12 and TANE, you can hard-code the duration of the sound, or store it in the extensions container of the config.txt file.&lt;br /&gt;
*The sound volume will be at a maximum for a camera position at or less than the value of the &#039;&#039;near&#039;&#039; parameter and will reduce with distance until the hearing position reaches &#039;&#039;far&#039;&#039;, when the sound will be inaudible.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCharacter==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCharacter(DriverCharacter driver)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;driver&#039;&#039;&#039; = DriverCharacter to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCharacter(dave);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==RemoveDriverCommand==&lt;br /&gt;
{{MethodHeader|public native void RemoveDriverCommand(DriverCommand command)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;command&#039;&#039;&#039; = DriverCommand to remove.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.RemoveDriverCommand(driverCommand);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetBadWeatherFog==&lt;br /&gt;
{{MethodHeader|public native void SetBadWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Bad weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetBadWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCamera==&lt;br /&gt;
{{MethodHeader|public native bool SetCamera(MapObject focus)&amp;lt;br&amp;gt;public native void SetCamera(Junction focus)&amp;lt;br&amp;gt;public native void SetCamera(Vehicle focus, int cameraMode)&amp;lt;br&amp;gt;public native void SetCamera(Train focus, int cameraMode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;focus&#039;&#039;&#039; = Object on which the camera is to be focused.&lt;br /&gt;
*&#039;&#039;cameraMode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Mode]] constants defining the view which should be assigned to the camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The first variant returns a boolean to indicate success or failure.&lt;br /&gt;
*Remaining variants do not return a value&lt;br /&gt;
&#039;Syntax&lt;br /&gt;
 World.SetCamera(train.GetVehicles[0],World.CAMERA_TRACKING); // sets the camera to track the first vehicle in the train.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraAngle==&lt;br /&gt;
{{MethodHeader|public void SetCameraAngle(int yaw, int pitch, float radius)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;yaw&#039;&#039;&#039; = Camera rotation in degrees, 90 is a direct front view.&lt;br /&gt;
*&#039;&#039;&#039;pitch&#039;&#039;&#039; = Camera angle relative to the horizon, 0 is horizontal, 90 points vertically upwards.&lt;br /&gt;
*&#039;&#039;&#039;radius&#039;&#039;&#039; = Distance in metres to the object in focus.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraAngle(90,0,25); // Sets the camera to a direct frontal view at 25 metres from the currently focused object.&lt;br /&gt;
;Notes&lt;br /&gt;
*&#039;&#039;Radius&#039;&#039; is measured from the object origin point (0,0,0).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraFlags==&lt;br /&gt;
{{MethodHeader|public native void SetCameraFlags(int flags)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039;  integer value defining what the user is permitted to do with the game camera.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 // User is permitted to select External or Tracking views only.&lt;br /&gt;
    World.SetCameraFlags(World.CAMERA_EXTERNAL | World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use any combination of [[#Camera_Flags|Camera Flags]] and [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetCameraMode==&lt;br /&gt;
{{MethodHeader|public void SetCameraMode(int mode)}}&lt;br /&gt;
;Parameter&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = Camera mode to select.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetCameraMode(World.CAMERA_TRACKING);&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Camera_View_Modes|Camera View Modes]] to set the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTime==&lt;br /&gt;
{{MethodHeader|public void SetGameTime(float time)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;time&#039;&#039;&#039; = new gane time to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTime(0.5);  // sets time to midnight&lt;br /&gt;
;Notes&lt;br /&gt;
*Game time is normalised to a value between 0.0 and 1.0&lt;br /&gt;
*0.0 = midday.&lt;br /&gt;
*0.5 = midnight&lt;br /&gt;
*Use the [[#Time_Values|Time Value]] constants to convert human readable times to normalised values. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGameTimeRate==&lt;br /&gt;
{{MethodHeader|public native void SetGameTimeRate(float rate)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;rate&#039;&#039;&#039; = New time rate to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGameTimeRate(World.TIME_RATE_8X); // sets game time to advance by 8 minutes per minute of real world time.&lt;br /&gt;
;Notes&lt;br /&gt;
*Use one of the [[#Time_Rate_Constants|Time Rate Constants]] to define the parameter.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGoodWeatherFog==&lt;br /&gt;
{{MethodHeader|public native void SetGoodWeatherFog(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Good weather fog distance to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGoodWeatherFog(0.5);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetGroundDrawDistance==&lt;br /&gt;
{{MethodHeader|public native void SetGroundDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = Ground draw distance in metres.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetGroundDrawDistance(1000.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Compatibility warning: Use of this function is not recommended, it may become non-functional in future Trainz versions.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSceneryDrawDistance==&lt;br /&gt;
{{MethodHeader|public native void SetSceneryDrawDistance(float distance)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;distance&#039;&#039;&#039; = unused.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
* Does nothing. Included for script compatibility only.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetTargetObserver==&lt;br /&gt;
{{MethodHeader|public void SetTargetObserver(GameObject observer)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;observer&#039;&#039;&#039; = The game object to receive targeting messages.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SetTargetObserver(self);&lt;br /&gt;
;Notes&lt;br /&gt;
* Causes the specified object to receive &amp;quot;Track&amp;quot;, &amp;quot;LeftClick&amp;quot; messages when a track is clicked. Causes the specified object to receive &amp;quot;Interface-Event&amp;quot;, &amp;quot;Left-Click&amp;quot; messages when a targetable MapObject is clicked. May cause the functionality of a left mouse click to change from what the user is expecting, so should be used with caution. Used in modal scripts to allow the user to indicate a location for train placement, etc. As there is only a single observer at any given time, the script must take care to only call this function when entering placement mode at the user&#039;s request.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetWeather==&lt;br /&gt;
{{MethodHeader|public native void SetWeather(int type, int changeability)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;type&#039;&#039;&#039; = Weather conditions as defined by one of the [[#Weather_Type_Constants|Weather Type Constants]].&lt;br /&gt;
*&#039;&#039;&#039;change&#039;&#039;&#039; = Weather variation as defined by one of the [[#Weather_Changeability_Constants|Weather Changeability Constants]].&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.SetWeather(World.WEATHER_TYPE_HEAVY_SNOW,World.WEATHER_CHANGEABILITY_EXTREME); // April in Paris.&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCamera==&lt;br /&gt;
{{MethodHeader|public native bool UserSetCamera(GameObject target)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = GameObject to set focus to.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if successful, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCamera(Router,GetGameObject(&amp;quot;Junction 5&amp;quot;));&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==UserSetCameraMode==&lt;br /&gt;
{{MethodHeader|public native void UserSetCameraMode(int mode)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;mode&#039;&#039;&#039; = One of the [[#Camera_View_Modes|Camera View Modes]]&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 World.UserSetCameraMode(World.CAMERA_ROAMING);  // switches to roaming view if permitted.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method respects the current [[#Camera_Flags|Camera Flag]] settings, disallowing any change which the flags do not permit.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_Math&amp;diff=26586</id>
		<title>Class Math</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_Math&amp;diff=26586"/>
		<updated>2020-12-28T14:50:46Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Related Methods */ Add link to RandBool&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Language Reference|API Hierarchy]]&lt;br /&gt;
**Math&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Math is a static class proving mathematical utility functions.&lt;br /&gt;
*When used in game code these methods must be prefixed &#039;&#039;Math.&#039;&#039; to reference the class.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Abs==&lt;br /&gt;
{{MethodHeader|public int Abs(int number)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;number&#039;&#039;&#039; = integer value to be processed.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The absolute value of &#039;&#039;number&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int answer = Math.Abs(-1);              // returns 1&lt;br /&gt;
 int answer = Math.Abs(1);               // returns 1&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fabs==&lt;br /&gt;
{{MethodHeader|public float Fabs(float number)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;number&#039;&#039;&#039; = floating point value to be processed.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The absolute value of &#039;&#039;number&#039;&#039;.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float answer = Math.Fabs(-1.0);              // returns 1.0&lt;br /&gt;
 float answer = Math.Fabs(1.0);               // returns 1.0&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fmax==&lt;br /&gt;
{{MethodHeader|public float Fmax(float number1, float number2)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;number1, number2&#039;&#039;&#039; = floating point values to be compared.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The greater of the two parameters.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float answer = Math.Fmax(1.0,2.0);              // returns 2.0&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fmin==&lt;br /&gt;
{{MethodHeader|public float Fmin(float number1, float number2)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;number1, number2&#039;&#039;&#039; = floating point values to be compared.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The lesser of the two parameters.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float answer = Math.Fmin(1.0,2.0);              // returns 1.0&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Rand==&lt;br /&gt;
{{MethodHeader|public native int Rand(int lower, int upper)&amp;lt;br&amp;gt;public native float Rand(float lower, float upper)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;lower&#039;&#039;&#039; = minimum value to be returned (inclusive)&lt;br /&gt;
*&#039;&#039;&#039;upper&#039;&#039;&#039; = maximum value to be returned (exclusive)&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A random floating point or integer value within the specified range.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int random = Math.Rand(1,10);         // returns a random number between 1 and 9 (see below) &lt;br /&gt;
 float random = Math.Rand(1.0,10.0);   // returns a random number between 1.0 and 9.9999999... (see below) &lt;br /&gt;
;Notes&lt;br /&gt;
*Rand operates on floating point numbers but if both parameters are integers it will return an integer result.&lt;br /&gt;
*If either parameter is a float then the result will also be a float.&lt;br /&gt;
*The lower bound is inclusive and is therefore included in the set of possible return values.&lt;br /&gt;
*The upper bound is exclusive and is never included.&lt;br /&gt;
*In the case of an integer result the returned value is rounded down to an integral value. Because of this the call &#039;&#039;Math.Rand(1,10) will return a result between 1 and 9.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sqrt==&lt;br /&gt;
{{MethodHeader|public native float Sqrt(float number)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;number&#039;&#039;&#039; = floating point value to find the square root of.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The square root of the parameter.&lt;br /&gt;
;Syntax&lt;br /&gt;
 float root = Math.Sqrt(64.0);              // returns 8.0&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
&lt;br /&gt;
[[Class TrainUtil#RandBool|TrainUtil.RandBool()]]&lt;br /&gt;
&lt;br /&gt;
[[Class Str#ToInt|Str.ToInt()]]&lt;br /&gt;
&lt;br /&gt;
[[Class Str#ToFloat|Str.ToFloat()]]&lt;br /&gt;
&lt;br /&gt;
[[Class Str#UnpackInt|Str.UnpackInt()]]&lt;br /&gt;
&lt;br /&gt;
[[Class Str#UnpackFloat|Str.UnpackFloat()]]&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Saving_and_Restoring_Data,_Using_Properties.&amp;diff=26585</id>
		<title>Saving and Restoring Data, Using Properties.</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Saving_and_Restoring_Data,_Using_Properties.&amp;diff=26585"/>
		<updated>2020-12-28T14:45:58Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add reference links, add navigation links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Apart from &#039;&#039;Init()&#039;&#039; there are several other standard methods which you can include which will be called at the appropriate time by the game. Two of the most important are &#039;&#039;GetProperties()&#039;&#039; which is called when Trainz needs to retrieve any useful data which your object might wish to save to the session file, and &#039;&#039;SetProperties()&#039;&#039; which is called when your object might want to read or update any data which has been saved by the game.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[Class PropertyObject#SetProperties|SetProperties]]()&#039;&#039; is called at the start of a Surveyor or Driver session and whenever the Object Property dialogue is saved. It is also used by the Undo system.  &lt;br /&gt;
* &#039;&#039;[[Class PropertyObject#GetPropertirs|GetProperties]]()&#039;&#039; is called when the Object Property dialogue is opened and when the current session is saved and exited.&lt;br /&gt;
&lt;br /&gt;
To demonstrate this we have a further script:&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Tutorial isclass MapObject {&lt;br /&gt;
 &lt;br /&gt;
    string Now;&lt;br /&gt;
    string Then;&lt;br /&gt;
 &lt;br /&gt;
    string GetTime(float GameTime) {&lt;br /&gt;
       string result = &amp;quot;Good Afternoon&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.25) result = &amp;quot;Good Evening&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.5) result = &amp;quot;Good Morning&amp;quot;;&lt;br /&gt;
       return result;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       Now = GetTime(World.GetGameTime());&lt;br /&gt;
       AddHandler(me,&amp;quot;Reminder&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ReminderHandler&amp;quot;);&lt;br /&gt;
       PostMessage(me,&amp;quot;Reminder&amp;quot;,Now,5.0);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public void SetProperties(Soup soup) {&lt;br /&gt;
       inherited(soup);&lt;br /&gt;
       Then = soup.GetNamedTag(&amp;quot;last&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public Soup GetProperties(void) {&lt;br /&gt;
       Soup soup = inherited();&lt;br /&gt;
       soup.SetNamedTag(&amp;quot;last&amp;quot;,Now);&lt;br /&gt;
       return soup;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    void ReminderHandler(Message msg) {&lt;br /&gt;
       if (Then != &amp;quot;&amp;quot;) {&lt;br /&gt;
          Str.TrimLeft(Then,&amp;quot;Good &amp;quot;);&lt;br /&gt;
          Then = &amp;quot;\nLast time we met was in the &amp;quot; + Then;&lt;br /&gt;
       }&lt;br /&gt;
       Interface.ShowPopupHelp(&amp;quot;Hello World, &amp;quot; + msg.minor,GetAsset(),Interface.GetTimeStamp())&lt;br /&gt;
       //Exception(&amp;quot;Hello World, &amp;quot; + msg.minor + Then + &amp;quot;\n\n&amp;quot;);// use this in old versions&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;string Now;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;string Then;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* The declaration of &#039;&#039;Now&#039;&#039; has been moved from &#039;&#039;Init()&#039;&#039; to the body of the script.&lt;br /&gt;
* A second declaration, &#039;&#039;Then&#039;&#039; has been added in the same place. &lt;br /&gt;
* Declaring them here makes them &#039;&#039;global&#039;&#039;, meaning that they can be used by any method within the script.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;public void SetProperties([[Class Soup|Soup]] soup) {&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* This is the standard declaration of &#039;&#039;[[Class PropertyObject#SetProperties|SetProperties]]()&#039;&#039;&lt;br /&gt;
* The method is public, since it needs to be called from outside the current script.&lt;br /&gt;
* It requires one parameter of type [[Class Soup|Soup]] (a Trainz database), which is supplied by the game.&lt;br /&gt;
* This database contains all the data about our object which has previously been saved to disc.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;inherited(soup);&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* As with &#039;&#039;Init()&#039;&#039; the equivalent function in the parent &#039;&#039;[[Class MapObject|MapObject]]&#039;&#039; must be called first.&lt;br /&gt;
* The &#039;&#039;Soup&#039;&#039; which the game has supplied is passed on to allow the parent to extract any data that it might need.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Then = soup.[[Class Soup#GetNamedTag|GetNamedTag]](&amp;quot;last&amp;quot;);&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* We need to know whether it was morning, afternoon or evening the last time that the session was saved.  &lt;br /&gt;
* &#039;&#039;GetNamedTag(&amp;quot;last&amp;quot;)&#039;&#039; retrieves this data from the &#039;&#039;Soup&#039;&#039; by specifying the key that will have been used to save it.&lt;br /&gt;
* The first time that we place our asset the tag will not contain any data and will return an empty string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;public [[Class Soup|Soup]] GetProperties(void) {&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* This is the standard declaration of &#039;&#039;[[Class PropertyObject#GetProperties|GetProperties]]()&#039;&#039;&lt;br /&gt;
* This is a public function which returns a &#039;&#039;Soup&#039;&#039; but requires no parameters.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Soup soup = inherited();&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* The equivalent function within the parent MapObject class must be called first.&lt;br /&gt;
* A &#039;&#039;Soup&#039;&#039; database is declared and the contents of the parent&#039;s &#039;&#039;Soup&#039;&#039; are assigned to it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;soup.[[Class Soup#SetNamedTag|SetNamedTag]](&amp;quot;last&amp;quot;,Now);&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Once the parent has provided its data we need to add our own information to the database.&lt;br /&gt;
* We can do this by creating or updating information referenced by the tag name &amp;quot;last&amp;quot;, so we set this item to be the current value of &#039;&#039;Now&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;return soup;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Having added our data we send the modified database back to the game to be written to disk.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;ReminderHandler&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
* This method has been amended to look at the value of the global variable &#039;&#039;Then&#039;&#039; which has been retrieved from the session files via the &#039;&#039;SetProperties()&#039;&#039; method. &lt;br /&gt;
* If the value of &#039;&#039;Then&#039;&#039; is not an empty string it is chopped and formatted so that it can be included in our &#039;&#039;ShowPopupHelp()&#039;&#039; or &#039;&#039;Exception()&#039;&#039; message.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this out:&lt;br /&gt;
* Modify the script as before.&lt;br /&gt;
* Load TRS and start a new map in Surveyor.&lt;br /&gt;
* Place a copy of your object, wait for the message which will be the same as before.&lt;br /&gt;
* Quit the map making sure to save the Surveyor session.&lt;br /&gt;
* Reload and wait for the message.&lt;br /&gt;
* This time it should look like this:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:The Last Time.jpg]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From now on every time the session is saved and reloaded your object will remember the time of day when it was last saved.  Rather than just saving Morning, Afternoon and Evening we could have updated the actual game time throughout the session and used the same mechanism to save the time when the session is closed down.  We could also use similar techniques to reset the clock on reloading the session.&lt;br /&gt;
&lt;br /&gt;
You have now used the most important of the standard method calls and learned how to send messages and how to save and retrieve data. Now we can move on to creating an asset and making it do something useful.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
&lt;br /&gt;
* Previous Tutorial: [[Talking to Yourself, Sending Messages.]]&lt;br /&gt;
* Next Tutorial: [[Setting Up the Asset.]]&lt;br /&gt;
* Back to [[Getting Started in TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Talking_to_Yourself,_Sending_Messages.&amp;diff=26584</id>
		<title>Talking to Yourself, Sending Messages.</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Talking_to_Yourself,_Sending_Messages.&amp;diff=26584"/>
		<updated>2020-12-28T14:40:42Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Correct previous tutorial link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Apart from sitting around waiting for the game engine to call your methods, there is another way of making your script wake up and do something useful, and that is to send it a message.  Messages are an important part of Trainz and are constantly being exchanged in the background between the game and its constituent objects.&lt;br /&gt;
&lt;br /&gt;
You can find more details of how the system works in the [[TrainzScript Message Reference]] or (if you have logging enabled) you can open &#039;&#039;jetlog.txt&#039;&#039; in your &#039;&#039;\Program Files\Auran\TRS####\&#039;&#039; folder and see a record of the messages that were sent in your last game session.  For now we will just send a message to ourself to do something at a future time. &lt;br /&gt;
&lt;br /&gt;
One of the problems with the way that TRS calls the &#039;&#039;Init()&#039;&#039; method is that there is no guarantee that every object in the map is initialised at exactly the same moment. As a result it is unsafe to carry out tasks in &#039;&#039;Init()&#039;&#039; which depend on information being available about other objects. It can therefore be quite useful to delay some of our initialisation until later, when we can be sure that all of the data we might need will be available.&lt;br /&gt;
&lt;br /&gt;
In practice no delay is necessary to accomplish this because TRS does not start to process messages until all object initialisation is complete but we will use a five second pause so that we can be sure of what is going on.&lt;br /&gt;
&lt;br /&gt;
Here is a modification to the script:&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Tutorial isclass MapObject {&lt;br /&gt;
 &lt;br /&gt;
    string GetTime(float GameTime) {&lt;br /&gt;
       string result = &amp;quot;Good Afternoon&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.25) result = &amp;quot;Good Evening&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.5) result = &amp;quot;Good Morning&amp;quot;;&lt;br /&gt;
       return result;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       string Now = GetTime(World.GetGameTime());&lt;br /&gt;
       AddHandler(me,&amp;quot;Reminder&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ReminderHandler&amp;quot;);&lt;br /&gt;
       PostMessage(me,&amp;quot;Reminder&amp;quot;,Now,5.0);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    void ReminderHandler(Message msg) {&lt;br /&gt;
       Interface.ShowPopupHelp(&amp;quot;Hello World, &amp;quot; + msg.minor,GetAsset(),Interface.GetTimeStamp())&lt;br /&gt;
       //Exception(&amp;quot;Hello World, &amp;quot; + msg.minor + &amp;quot;\n\n&amp;quot;);// use this instead of ShowPopupHelp in old versions&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[Class GameObject#AddHandler|AddHandler]](me,&amp;quot;Reminder&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ReminderHandler&amp;quot;);&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;AddHandler&#039;&#039; sets up a mechanism to listen for messages. &lt;br /&gt;
* Messages usually consist of two text strings separated by a comma, known as the &#039;&#039;Major&#039;&#039; and the &#039;&#039;Minor&#039;&#039; of the message. &lt;br /&gt;
* The second and third parameters specify the major and minor. &lt;br /&gt;
* Since the third parameter is an empty string this handler will ignore it, in this case we are listening for any message which starts with the word &#039;&#039;Reminder&#039;&#039;&lt;br /&gt;
* The last parameter specifies the method to which the message will be sent for processing, in this case &#039;&#039;ReminderHandler&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[Class GameObject#PostMessage|PostMessage]](me,&amp;quot;Reminder&amp;quot;,Now,5.0);&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;PostMessage&#039;&#039; sends a message&lt;br /&gt;
* &#039;&#039;me&#039;&#039; is the message destination, in this case we are sending a message to ourself.&lt;br /&gt;
* &#039;&#039;Reminder&#039;&#039; is the message major&lt;br /&gt;
* &#039;&#039;Now&#039;&#039;, the result of our call to &#039;&#039;GetTime()&#039;&#039; is the message minor.&lt;br /&gt;
* &#039;&#039;5.0&#039;&#039; is the number of seconds that the game should delay before actually dispatching the message.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;void ReminderHandler(Message msg) {&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;ReminderHandler&#039;&#039; is the method name that we specified in our call to &#039;&#039;AddHandler&#039;&#039; and is the function that will process our message.&lt;br /&gt;
* Message handlers always take one parameter of the predefined Message type.&lt;br /&gt;
* The ShowPopupHelp or Exception call is the same as before, it has simply been moved from Init() to &#039;&#039;ReminderHandler&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Modify the script as before and load your asset into Trainz.  The result should be exactly the same as last time except that there will be a five second delay between placing the object and receiving the message.&lt;br /&gt;
&lt;br /&gt;
In practice you can send messages to other objects and you can listen for, and react to, messages from other objects. Sending a message to yourself can be a very useful device though and it should be helpful to see the whole of the process in one object script.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
&lt;br /&gt;
* Previous Tutorial: [[Getting Information From the Game, Writing Your Own Methods.]]&lt;br /&gt;
* Next Tutorial: [[Saving and Restoring Data, Using Properties.]]&lt;br /&gt;
* Back to [[Getting Started in TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Getting_Information_From_the_Game,_Writing_Your_Own_Methods.&amp;diff=26583</id>
		<title>Getting Information From the Game, Writing Your Own Methods.</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Getting_Information_From_the_Game,_Writing_Your_Own_Methods.&amp;diff=26583"/>
		<updated>2020-12-28T14:40:08Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add navigation links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Although we can&#039;t control when scripts are called by the game, we can control what happens when the various standard methods are actually executed. We could add pages of code to our &#039;&#039;Init()&#039;&#039; method to do all sorts of things, but it makes life more manageable if we write our own methods to carry out a specific task and have them called by &#039;&#039;Init()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Reopen &#039;&#039;Tutorial.gs&#039;&#039; and edit it, or copy and paste, to look like this:&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Tutorial isclass MapObject {&lt;br /&gt;
 &lt;br /&gt;
    string GetTime(float GameTime) {&lt;br /&gt;
       string result = &amp;quot;Good Afternoon&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.25) result = &amp;quot;Good Evening&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.5) result = &amp;quot;Good Morning&amp;quot;;&lt;br /&gt;
       return result;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       string Now = GetTime(World.GetGameTime());&lt;br /&gt;
       Interface.ShowPopupHelp(&amp;quot;Hello World, &amp;quot; + Now,GetAsset(),Interface.GetTimeStamp())&lt;br /&gt;
       //Exception(&amp;quot;Hello World, &amp;quot; + Now + &amp;quot;\n\n&amp;quot;); // use this instead of ShowPopupHelp in old builds&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
You will have created a new method called &#039;&#039;GetTime()&#039;&#039; and added a call to that method in &#039;&#039;Init()&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Looking at the code as before:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;string GetTime(float GameTime) {&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* This is the method prototype which defines the information required and the data which will be returned to the caller.&lt;br /&gt;
* This method will not be accessible to external scripts so the &#039;&#039;public&#039;&#039; qualifier is not required&lt;br /&gt;
* &#039;&#039;string&#039;&#039; indicates that the method will return data as a character string.&lt;br /&gt;
* &#039;&#039;GetTime&#039;&#039; is the name of the method.&lt;br /&gt;
* &#039;&#039;(float GameTime)&#039;&#039; means that the method will need one float (real number) as a parameter.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;string result = &amp;quot;Good Afternoon&amp;quot;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
declares a string variable and assigns a value to it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;if (GameTime &amp;gt;= 0.25) result = &amp;quot;Good Evening&amp;quot;;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
looks at the value of the float parameter and alters the value of result if it is 0.25 or more.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;if (GameTime &amp;gt;= 0.5) result = &amp;quot;Good Morning&amp;quot;;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
does the same thing for a &#039;&#039;GameTime&#039;&#039; value of 0.5 or more.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;return result;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
sends the value back to the caller as a string.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;}&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
indicates that the method code is complete.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will notice that &#039;&#039;Init()&#039;&#039; has also has been amended.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;string Now = GetTime(World.GetGameTime());&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* declares a string variable and assigns the value to be returned by our new method.&lt;br /&gt;
* &#039;&#039;[[Class World|World]].[[Class World#GetGameTime|GetGameTime()]]&#039;&#039; is a built-in function that provides a value between 0 and 1, representing the time in Trainz. &lt;br /&gt;
* This value is sent directly to the &#039;&#039;GetTime&#039;&#039; function to provide the parameter which it needs to decide whether it is morning, afternoon or evening.&lt;br /&gt;
* The character string produced by &#039;&#039;GetTime&#039;&#039; is assigned to &#039;&#039;Now&#039;&#039; and then added into our message.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Save &#039;&#039;Tutorial.gs&#039;&#039; and recommit the asset. When you open Surveyor and place a new copy of your asset (or reopen a map with a copy included) this should be the result:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:GoodMorning.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Your message might of course be different if you have Surveyor set to a different time.&lt;br /&gt;
* It would have been perfectly possible for GetTime to have returned a properly formatted time such as 23:15:34.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Navigation==&lt;br /&gt;
&lt;br /&gt;
* Previous Tutorial: [[Hello World, Setting Up An Asset Script.]]&lt;br /&gt;
* Next Tutorial: [[Talking to Yourself, Sending Messages.]]&lt;br /&gt;
* Back to [[Getting Started in TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Talking_to_Yourself,_Sending_Messages.&amp;diff=26582</id>
		<title>Talking to Yourself, Sending Messages.</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Talking_to_Yourself,_Sending_Messages.&amp;diff=26582"/>
		<updated>2020-12-28T14:39:07Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add reference links, add navigation links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Apart from sitting around waiting for the game engine to call your methods, there is another way of making your script wake up and do something useful, and that is to send it a message.  Messages are an important part of Trainz and are constantly being exchanged in the background between the game and its constituent objects.&lt;br /&gt;
&lt;br /&gt;
You can find more details of how the system works in the [[TrainzScript Message Reference]] or (if you have logging enabled) you can open &#039;&#039;jetlog.txt&#039;&#039; in your &#039;&#039;\Program Files\Auran\TRS####\&#039;&#039; folder and see a record of the messages that were sent in your last game session.  For now we will just send a message to ourself to do something at a future time. &lt;br /&gt;
&lt;br /&gt;
One of the problems with the way that TRS calls the &#039;&#039;Init()&#039;&#039; method is that there is no guarantee that every object in the map is initialised at exactly the same moment. As a result it is unsafe to carry out tasks in &#039;&#039;Init()&#039;&#039; which depend on information being available about other objects. It can therefore be quite useful to delay some of our initialisation until later, when we can be sure that all of the data we might need will be available.&lt;br /&gt;
&lt;br /&gt;
In practice no delay is necessary to accomplish this because TRS does not start to process messages until all object initialisation is complete but we will use a five second pause so that we can be sure of what is going on.&lt;br /&gt;
&lt;br /&gt;
Here is a modification to the script:&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Tutorial isclass MapObject {&lt;br /&gt;
 &lt;br /&gt;
    string GetTime(float GameTime) {&lt;br /&gt;
       string result = &amp;quot;Good Afternoon&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.25) result = &amp;quot;Good Evening&amp;quot;;&lt;br /&gt;
       if (GameTime &amp;gt;= 0.5) result = &amp;quot;Good Morning&amp;quot;;&lt;br /&gt;
       return result;&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       string Now = GetTime(World.GetGameTime());&lt;br /&gt;
       AddHandler(me,&amp;quot;Reminder&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ReminderHandler&amp;quot;);&lt;br /&gt;
       PostMessage(me,&amp;quot;Reminder&amp;quot;,Now,5.0);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    void ReminderHandler(Message msg) {&lt;br /&gt;
       Interface.ShowPopupHelp(&amp;quot;Hello World, &amp;quot; + msg.minor,GetAsset(),Interface.GetTimeStamp())&lt;br /&gt;
       //Exception(&amp;quot;Hello World, &amp;quot; + msg.minor + &amp;quot;\n\n&amp;quot;);// use this instead of ShowPopupHelp in old versions&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[Class GameObject#AddHandler|AddHandler]](me,&amp;quot;Reminder&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ReminderHandler&amp;quot;);&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;AddHandler&#039;&#039; sets up a mechanism to listen for messages. &lt;br /&gt;
* Messages usually consist of two text strings separated by a comma, known as the &#039;&#039;Major&#039;&#039; and the &#039;&#039;Minor&#039;&#039; of the message. &lt;br /&gt;
* The second and third parameters specify the major and minor. &lt;br /&gt;
* Since the third parameter is an empty string this handler will ignore it, in this case we are listening for any message which starts with the word &#039;&#039;Reminder&#039;&#039;&lt;br /&gt;
* The last parameter specifies the method to which the message will be sent for processing, in this case &#039;&#039;ReminderHandler&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[Class GameObject#PostMessage|PostMessage]](me,&amp;quot;Reminder&amp;quot;,Now,5.0);&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* &#039;&#039;PostMessage&#039;&#039; sends a message&lt;br /&gt;
* &#039;&#039;me&#039;&#039; is the message destination, in this case we are sending a message to ourself.&lt;br /&gt;
* &#039;&#039;Reminder&#039;&#039; is the message major&lt;br /&gt;
* &#039;&#039;Now&#039;&#039;, the result of our call to &#039;&#039;GetTime()&#039;&#039; is the message minor.&lt;br /&gt;
* &#039;&#039;5.0&#039;&#039; is the number of seconds that the game should delay before actually dispatching the message.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;void ReminderHandler(Message msg) {&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;ReminderHandler&#039;&#039; is the method name that we specified in our call to &#039;&#039;AddHandler&#039;&#039; and is the function that will process our message.&lt;br /&gt;
* Message handlers always take one parameter of the predefined Message type.&lt;br /&gt;
* The ShowPopupHelp or Exception call is the same as before, it has simply been moved from Init() to &#039;&#039;ReminderHandler&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Modify the script as before and load your asset into Trainz.  The result should be exactly the same as last time except that there will be a five second delay between placing the object and receiving the message.&lt;br /&gt;
&lt;br /&gt;
In practice you can send messages to other objects and you can listen for, and react to, messages from other objects. Sending a message to yourself can be a very useful device though and it should be helpful to see the whole of the process in one object script.&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
&lt;br /&gt;
* Previous Tutorial: [[Hello World, Setting Up An Asset Script.]]&lt;br /&gt;
* Next Tutorial: [[Saving and Restoring Data, Using Properties.]]&lt;br /&gt;
* Back to [[Getting Started in TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Hello_World,_Setting_Up_An_Asset_Script.&amp;diff=26581</id>
		<title>Hello World, Setting Up An Asset Script.</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Hello_World,_Setting_Up_An_Asset_Script.&amp;diff=26581"/>
		<updated>2020-12-28T14:37:56Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Next Tutorial */ Add navigation links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Warning:  The original tutorial appears to be faulty for TRS19 and perhaps TANE.  The message that should display in the &amp;quot;ShowHelp&amp;quot; message box is unreadable perhaps because of background colour changes.  My intention is to rewrite the tutorial so it will output messages to the screen while in driver and/or write messages to the logs.  This achieves the original aim and provides a useful debugging tool. (pcas1986)&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An alternative version of the tutorial has been provided for TRS19, although it is currently significantly more complex.&lt;br /&gt;
&lt;br /&gt;
== Original Tutorial ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s traditional for your first script to print Hello World to the screen. Trainz doesn&#039;t actually make this very easy because there isn&#039;t a straightforward way of writing to the user interface, especially in Surveyor. So we will have to use the PopupHelp browser to show our results. This will produce a message box in the middle of the screen.&lt;br /&gt;
&lt;br /&gt;
This is an asset script which will do this:&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Tutorial isclass MapObject {&lt;br /&gt;
 &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       Interface.ShowHelpPopup(&amp;quot;Hello World&amp;quot;,GetAsset(),Interface.GetTimeStamp());&lt;br /&gt;
       //Exception(&amp;quot;Hello World\n\n&amp;quot;); // use this instead of ShowHelpPopup in old builds&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
I&#039;ve kept comments separate from the code to start with to keep the code more legible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#include|include]] &amp;quot;MapObject.gs&amp;quot;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
We are going to be using &#039;&#039;MapObject&#039;&#039; as a base for the script. In order to do this we need to include a copy of the code for that class, this is achieved by using the keyword &#039;&#039;include&#039;&#039; followed by the name of the appropriate Trainz script file. Note that this statement is unusual in that it doesn&#039;t have a semi-colon on the end.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#class|class]] Tutorial isclass [[Class MapObject|MapObject]] {&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This is the prototype or header for the script, it specifies that the name of the script class is going to be &#039;&#039;Tutorial&#039;&#039; and that it will subclass (inherit) all of the capabilities of the &#039;&#039;[[Class MapObject|MapObject]]&#039;&#039; base class. (In simple terms a class is a set of related functions. The word inherit means that the new Tutorial class will have access to all the functions of the standard MapObject class.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#public|public]] void [[Class TrainzGameObject#Init|Init]](void) {&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Except in a TRS2004 scenario, Trainz scripts are incapable of doing anything of their own account. It is crucial that this is fully understood. They must always be instructed by the game.  The mechanism that scripts use to accept instructions is the provision of standardised methods that will be called by the game engine. The most basic of these is &#039;&#039;Init()&#039;&#039; which is called whenever an object is first placed, or when it is already included in a map loaded by the game. (In simple terms a method is another name for a function.)&lt;br /&gt;
&lt;br /&gt;
This is the header for the &#039;&#039;Init()&#039;&#039; function, a method which all asset scripts must contain. &lt;br /&gt;
* &#039;&#039;public means&#039;&#039; that the method is available to be called from elsewhere in Trainz.&lt;br /&gt;
* &#039;&#039;void&#039;&#039; means that the method does not return any value to the caller.&lt;br /&gt;
* &#039;&#039;(void)&#039;&#039; means that the method does not need any parameter information to be passed in when it is called.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#inherited|inherited()]];&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This should always be the first call in an &#039;&#039;Init()&#039;&#039; method. It ensures that any initialisation required by the parent class, in this case &#039;&#039;MapObject&#039;&#039;, will be undertaken before the script&#039;s own code is processed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[Class Interface|Interface]].ShowHelpPopup(&amp;quot;Hello World&amp;quot;,[[TrainzGameObject#GetAsset|GetAsset]](),Interface.[[Class Interface#GetTimeStamp|GetTimeStamp]]());&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This prints out the message to the screen.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;}&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;};&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
inform the compiler that the Init() method and the class definition, respectively, have finished.&lt;br /&gt;
&lt;br /&gt;
To test this out:&lt;br /&gt;
* Find a simple unscripted asset, say a tree or a building, of &#039;&#039;kind scenery.&#039;&#039;&lt;br /&gt;
* Open its folder and create a plain text file called &#039;&#039;Tutorial.gs&#039;&#039;&lt;br /&gt;
* Copy and paste the script code in the box above into the text file.&lt;br /&gt;
* Open the asset&#039;s &#039;&#039;config.txt&#039;&#039; file and add these two tags:&lt;br /&gt;
* &#039;&#039;script Tutorial&#039;&#039;&lt;br /&gt;
* &#039;&#039;class Tutorial&#039;&#039;&lt;br /&gt;
* Trainzscript is case sensitive, make sure you capitalise the tags correctly.&lt;br /&gt;
* Commit the asset, start TRS, and open a map in Surveyor.&lt;br /&gt;
* Find the asset and place a copy on the map&lt;br /&gt;
* If you see this then you have successfully created your first asset script:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Note: Before TS2012&#039;&#039;&#039;, you will need to use an exception to display your text.  Refer to old versions of these pages for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:HelloWorld.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Trainz 2019 Example ==&lt;br /&gt;
&lt;br /&gt;
The following Trainz-2019-compatible example will display &amp;quot;Hello World!&amp;quot; in three ways:&lt;br /&gt;
* Writing a message to the Developer Log using &#039;&#039;Interface.Print&#039;&#039;&lt;br /&gt;
* Writing a message to the Driver&#039;s Message Window, using the same &#039;&#039;Interface.Print&#039;&#039;&lt;br /&gt;
* Displaying a browser window with a simple HTML page&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre;&amp;quot;&amp;gt;&lt;br /&gt;
include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class MyFirstScript isclass MapObject {&lt;br /&gt;
    Browser browser;&lt;br /&gt;
    void HelloWorld(Message msg);&lt;br /&gt;
    public void Init() {&lt;br /&gt;
        inherited();&lt;br /&gt;
        // Wait 5s for UI to load - browser window will not display if we continue too early.&lt;br /&gt;
        // It is not possible to use Sleep() within an Init method.&lt;br /&gt;
        // &lt;br /&gt;
        AddHandler(me,&amp;quot;HelloWorld&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;HelloWorld&amp;quot;);&lt;br /&gt;
        PostMessage(me,&amp;quot;HelloWorld&amp;quot;,&amp;quot;&amp;quot;,5.0);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void HelloWorld(Message msg) {&lt;br /&gt;
        if (!browser) {&lt;br /&gt;
            browser = Constructors.NewBrowser();&lt;br /&gt;
        }&lt;br /&gt;
        browser.SetWindowPosition(0,0);&lt;br /&gt;
        browser.SetWindowStyle(browser.STYLE_DEFAULT);&lt;br /&gt;
        browser.SetWindowSize(200,500);&lt;br /&gt;
        browser.LoadHTMLString(GetAsset(), &amp;quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;Hello World!&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        // This log entry will be visible in Launcher &amp;gt; Developer &amp;gt; Show Logs,&lt;br /&gt;
        // and in the Driver messages&lt;br /&gt;
        Interface.Print(&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        Interface.SetMessageWindowVisible(true);&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log output can be viewed (in Trainz 2019) via Launcher &amp;gt; Developer &amp;gt; Show Logs. It may be helpful to also use Clear Logs before opening the session in Driver.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:TrainzHelloWorldBrowser.png|Hello World message - in-game browser&lt;br /&gt;
File:TrainzHelloWorldMessage.png|Hello World message - driver messages&lt;br /&gt;
File:TrainzHelloWorldLog.PNG|Hello World message - developer log&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
&lt;br /&gt;
* Next Tutorial: [[Getting Information From the Game, Writing Your Own Methods.]]&lt;br /&gt;
* Back to [[Getting Started in TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Hello_World,_Setting_Up_An_Asset_Script.&amp;diff=26580</id>
		<title>Hello World, Setting Up An Asset Script.</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Hello_World,_Setting_Up_An_Asset_Script.&amp;diff=26580"/>
		<updated>2020-12-28T14:33:43Z</updated>

		<summary type="html">&lt;p&gt;Danny252: /* Original Tutorial */ Add links to Init() docs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Warning:  The original tutorial appears to be faulty for TRS19 and perhaps TANE.  The message that should display in the &amp;quot;ShowHelp&amp;quot; message box is unreadable perhaps because of background colour changes.  My intention is to rewrite the tutorial so it will output messages to the screen while in driver and/or write messages to the logs.  This achieves the original aim and provides a useful debugging tool. (pcas1986)&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An alternative version of the tutorial has been provided for TRS19, although it is currently significantly more complex.&lt;br /&gt;
&lt;br /&gt;
== Original Tutorial ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s traditional for your first script to print Hello World to the screen. Trainz doesn&#039;t actually make this very easy because there isn&#039;t a straightforward way of writing to the user interface, especially in Surveyor. So we will have to use the PopupHelp browser to show our results. This will produce a message box in the middle of the screen.&lt;br /&gt;
&lt;br /&gt;
This is an asset script which will do this:&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Tutorial isclass MapObject {&lt;br /&gt;
 &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       Interface.ShowHelpPopup(&amp;quot;Hello World&amp;quot;,GetAsset(),Interface.GetTimeStamp());&lt;br /&gt;
       //Exception(&amp;quot;Hello World\n\n&amp;quot;); // use this instead of ShowHelpPopup in old builds&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
I&#039;ve kept comments separate from the code to start with to keep the code more legible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#include|include]] &amp;quot;MapObject.gs&amp;quot;&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
We are going to be using &#039;&#039;MapObject&#039;&#039; as a base for the script. In order to do this we need to include a copy of the code for that class, this is achieved by using the keyword &#039;&#039;include&#039;&#039; followed by the name of the appropriate Trainz script file. Note that this statement is unusual in that it doesn&#039;t have a semi-colon on the end.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#class|class]] Tutorial isclass [[Class MapObject|MapObject]] {&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This is the prototype or header for the script, it specifies that the name of the script class is going to be &#039;&#039;Tutorial&#039;&#039; and that it will subclass (inherit) all of the capabilities of the &#039;&#039;[[Class MapObject|MapObject]]&#039;&#039; base class. (In simple terms a class is a set of related functions. The word inherit means that the new Tutorial class will have access to all the functions of the standard MapObject class.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#public|public]] void [[Class TrainzGameObject#Init|Init]](void) {&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Except in a TRS2004 scenario, Trainz scripts are incapable of doing anything of their own account. It is crucial that this is fully understood. They must always be instructed by the game.  The mechanism that scripts use to accept instructions is the provision of standardised methods that will be called by the game engine. The most basic of these is &#039;&#039;Init()&#039;&#039; which is called whenever an object is first placed, or when it is already included in a map loaded by the game. (In simple terms a method is another name for a function.)&lt;br /&gt;
&lt;br /&gt;
This is the header for the &#039;&#039;Init()&#039;&#039; function, a method which all asset scripts must contain. &lt;br /&gt;
* &#039;&#039;public means&#039;&#039; that the method is available to be called from elsewhere in Trainz.&lt;br /&gt;
* &#039;&#039;void&#039;&#039; means that the method does not return any value to the caller.&lt;br /&gt;
* &#039;&#039;(void)&#039;&#039; means that the method does not need any parameter information to be passed in when it is called.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[TrainzScript Keywords#inherited|inherited()]];&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This should always be the first call in an &#039;&#039;Init()&#039;&#039; method. It ensures that any initialisation required by the parent class, in this case &#039;&#039;MapObject&#039;&#039;, will be undertaken before the script&#039;s own code is processed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;[[Class Interface|Interface]].ShowHelpPopup(&amp;quot;Hello World&amp;quot;,[[TrainzGameObject#GetAsset|GetAsset]](),Interface.[[Class Interface#GetTimeStamp|GetTimeStamp]]());&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This prints out the message to the screen.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;}&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;};&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
inform the compiler that the Init() method and the class definition, respectively, have finished.&lt;br /&gt;
&lt;br /&gt;
To test this out:&lt;br /&gt;
* Find a simple unscripted asset, say a tree or a building, of &#039;&#039;kind scenery.&#039;&#039;&lt;br /&gt;
* Open its folder and create a plain text file called &#039;&#039;Tutorial.gs&#039;&#039;&lt;br /&gt;
* Copy and paste the script code in the box above into the text file.&lt;br /&gt;
* Open the asset&#039;s &#039;&#039;config.txt&#039;&#039; file and add these two tags:&lt;br /&gt;
* &#039;&#039;script Tutorial&#039;&#039;&lt;br /&gt;
* &#039;&#039;class Tutorial&#039;&#039;&lt;br /&gt;
* Trainzscript is case sensitive, make sure you capitalise the tags correctly.&lt;br /&gt;
* Commit the asset, start TRS, and open a map in Surveyor.&lt;br /&gt;
* Find the asset and place a copy on the map&lt;br /&gt;
* If you see this then you have successfully created your first asset script:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Note: Before TS2012&#039;&#039;&#039;, you will need to use an exception to display your text.  Refer to old versions of these pages for details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:HelloWorld.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Trainz 2019 Example ==&lt;br /&gt;
&lt;br /&gt;
The following Trainz-2019-compatible example will display &amp;quot;Hello World!&amp;quot; in three ways:&lt;br /&gt;
* Writing a message to the Developer Log using &#039;&#039;Interface.Print&#039;&#039;&lt;br /&gt;
* Writing a message to the Driver&#039;s Message Window, using the same &#039;&#039;Interface.Print&#039;&#039;&lt;br /&gt;
* Displaying a browser window with a simple HTML page&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space: pre;&amp;quot;&amp;gt;&lt;br /&gt;
include &amp;quot;MapObject.gs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class MyFirstScript isclass MapObject {&lt;br /&gt;
    Browser browser;&lt;br /&gt;
    void HelloWorld(Message msg);&lt;br /&gt;
    public void Init() {&lt;br /&gt;
        inherited();&lt;br /&gt;
        // Wait 5s for UI to load - browser window will not display if we continue too early.&lt;br /&gt;
        // It is not possible to use Sleep() within an Init method.&lt;br /&gt;
        // &lt;br /&gt;
        AddHandler(me,&amp;quot;HelloWorld&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;HelloWorld&amp;quot;);&lt;br /&gt;
        PostMessage(me,&amp;quot;HelloWorld&amp;quot;,&amp;quot;&amp;quot;,5.0);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void HelloWorld(Message msg) {&lt;br /&gt;
        if (!browser) {&lt;br /&gt;
            browser = Constructors.NewBrowser();&lt;br /&gt;
        }&lt;br /&gt;
        browser.SetWindowPosition(0,0);&lt;br /&gt;
        browser.SetWindowStyle(browser.STYLE_DEFAULT);&lt;br /&gt;
        browser.SetWindowSize(200,500);&lt;br /&gt;
        browser.LoadHTMLString(GetAsset(), &amp;quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;Hello World!&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        // This log entry will be visible in Launcher &amp;gt; Developer &amp;gt; Show Logs,&lt;br /&gt;
        // and in the Driver messages&lt;br /&gt;
        Interface.Print(&amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
        Interface.SetMessageWindowVisible(true);&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log output can be viewed (in Trainz 2019) via Launcher &amp;gt; Developer &amp;gt; Show Logs. It may be helpful to also use Clear Logs before opening the session in Driver.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
File:TrainzHelloWorldBrowser.png|Hello World message - in-game browser&lt;br /&gt;
File:TrainzHelloWorldMessage.png|Hello World message - driver messages&lt;br /&gt;
File:TrainzHelloWorldLog.PNG|Hello World message - developer log&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Next Tutorial ==&lt;br /&gt;
&lt;br /&gt;
[[Getting Information From the Game, Writing Your Own Methods.]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Operators&amp;diff=26579</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Operators&amp;diff=26579"/>
		<updated>2020-12-28T14:23:16Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Document float-&amp;gt;int cast rounding behaviour. Document string concatenation (addition)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The operator sections set out below follow the language&#039;s preference rules. The earlier the operator appears in the list, the higher the precedence and the earlier the listed operators will be evaluated.&lt;br /&gt;
&lt;br /&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;
&lt;br /&gt;
__NOEDITSECTION__&lt;br /&gt;
==Operators (1), Grouping &amp;amp; Indexing==&lt;br /&gt;
{{MethodHeader|( )}}&lt;br /&gt;
*Expression grouping. &lt;br /&gt;
*In common with most programming languages Trainzscript carries out arithmetical operations in the order defined by operator precedence rules.&lt;br /&gt;
*&#039;&#039;3 + 2 * 12 - 7&#039;&#039; would return 20, because multiplication is of higher precedence than addition and subtraction.&lt;br /&gt;
*You can force the compiler to change this sequence and make your intentions crystal clear by declaring this as &#039;&#039;((3 + 2) * 12) - 7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ i ]}}&lt;br /&gt;
*Array and string indexing.  &lt;br /&gt;
*Arrays are zero based and &#039;&#039;arrayName[0]&#039;&#039; will represent the first element.  &lt;br /&gt;
*Similarly &#039;&#039;arrayName[arrayName.size() - 1]&#039;&#039; will represent the last element.  &lt;br /&gt;
*A call to a value outside the range &#039;&#039;[0 … size()-1]&#039;&#039; will generate an exception. &lt;br /&gt;
*This notation can also be used to return a single character from a string.&lt;br /&gt;
&lt;br /&gt;
 intArray[intArray.size()] = 5    // will add the new value of 5 to the end of the array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ i , j ]}}&lt;br /&gt;
*Array and String range index. &lt;br /&gt;
*The expression &#039;&#039;string[0,string.size()]&#039;&#039; will return the entire string.  &lt;br /&gt;
*The integers i and j are best thought of as &#039;cursor&#039; positions where i is the first element and j is one beyond the last element. &lt;br /&gt;
*If i is omitted the range will start at the beginning of the array (index 0). &lt;br /&gt;
*If j is omitted the range will end after the end of the array (.size()). &lt;br /&gt;
*To return a single element other than the first or last, both i and j are required. &lt;br /&gt;
*Given the declaration &#039;&#039;string s = &amp;quot;abcde&amp;quot;&#039;&#039;&lt;br /&gt;
 s[,3]  = &amp;quot;abc&amp;quot;&lt;br /&gt;
 s[2,3] = &amp;quot;c&amp;quot;&lt;br /&gt;
 s[2,]  = &amp;quot;cde&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 intArray[2,3] = null             // will delete the third element of the array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ i , ]}}&lt;br /&gt;
*Indexes from i to the end of the string or array inclusively.&lt;br /&gt;
 s[2,]  = &amp;quot;cde&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ , j ]}}&lt;br /&gt;
*Indexes from the start of the string or array to element j-1 inclusively.&lt;br /&gt;
 s[,3]  = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|.}}&lt;br /&gt;
*Dereference operator&lt;br /&gt;
 GetAsset().GetConfigSoup();&lt;br /&gt;
*The &#039;&#039;GetConfigSoup()&#039;&#039; method to be called is the method defined for the class &#039;&#039;GetAsset()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|!}}&lt;br /&gt;
*Not Operator&lt;br /&gt;
 !true = false&lt;br /&gt;
 !vehicle = null&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (2), Incremental and Unary Operators==&lt;br /&gt;
{{MethodHeader|++}}&lt;br /&gt;
*Increments a numeric value by 1.&lt;br /&gt;
*Often used for control variables in loops:&lt;br /&gt;
 for(n = 0; n &amp;lt; list.size(); n++) {&lt;br /&gt;
    DoStuffWith(n);&lt;br /&gt;
 }&lt;br /&gt;
*Increments n by 1 on each pass through the loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|--}}&lt;br /&gt;
*Decrements a numeric value by 1.&lt;br /&gt;
*Often used for control variables in loops:&lt;br /&gt;
 n = list.size() - 1;&lt;br /&gt;
 while(n &amp;gt;= 0) {&lt;br /&gt;
    DoStuffWith(n);&lt;br /&gt;
    n--;&lt;br /&gt;
 }&lt;br /&gt;
*Decrements n by 1 on each pass through the loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|+}}&lt;br /&gt;
*Unary plus.&lt;br /&gt;
*Used to denote that a value is positive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|-}}&lt;br /&gt;
*Unary minus.&lt;br /&gt;
*Used to denote that a value is negative.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (3), Casts==&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(bool)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Boolean type cast.&lt;br /&gt;
 (bool) 0 = false&lt;br /&gt;
 (bool) 0.0 = false&lt;br /&gt;
 (bool) n = true     //where n is greater than zero&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(int)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Integer type cast. Floats will be truncated (rounded down).&lt;br /&gt;
 (int) 5.0 = 5&lt;br /&gt;
 (int) 5.1 = 5&lt;br /&gt;
 (int) 5.6 = 5&lt;br /&gt;
 (int) true = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(float)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Float type cast.&lt;br /&gt;
 (float) 100 = 100.0&lt;br /&gt;
 (float) false = 0.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(string)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*String type cast.&lt;br /&gt;
 (string) 1 = &amp;quot;1&amp;quot;&lt;br /&gt;
 (string) 0.99 = &amp;quot;0.99&amp;quot;&lt;br /&gt;
 (string) false = &amp;quot;false&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|(&#039;&#039;reference&#039;&#039;)}}&lt;br /&gt;
*Class type cast.&lt;br /&gt;
 &amp;lt;font color=red&amp;gt;How is this used and how is it different from cast&amp;lt;Class&amp;gt;?&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;cast&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Dynamic cast.  &lt;br /&gt;
*Returns null if the reference cannot be converted to the class specified by className.  &lt;br /&gt;
*Note that ancestors of the specified class will be returned.&lt;br /&gt;
 Vehicle vehicle = cast&amp;lt;Vehicle&amp;gt;msg.src;&lt;br /&gt;
 &lt;br /&gt;
 MeshObject meshObject;&lt;br /&gt;
 GameObject gameObject = cast&amp;lt;GameObject&amp;gt;meshObject;  // returns meshObject if the object exists, null otherwise&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;size()&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Returns the number of members of an array or the length of a string.  &lt;br /&gt;
*In the case of an array this does not necessarily mean that all (or any) of the members actually contain values.&lt;br /&gt;
 given string s = &amp;quot;abcde&amp;quot;;&lt;br /&gt;
 s.size() = 5;&lt;br /&gt;
 &lt;br /&gt;
 int[] numbers = new int[5];       // creates an empty array of 5 integers&lt;br /&gt;
 numbers.size() = 5;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;copy()&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Creates a copy of an array or string. &lt;br /&gt;
*This is different from a simple assignment which points a variable to the same memory address as an existing variable.&lt;br /&gt;
*Array.copy() or string.copy() creates an additional copy of the data.&lt;br /&gt;
 int[] numbers = new int[5];&lt;br /&gt;
 int[] moreNumbers;&lt;br /&gt;
 &lt;br /&gt;
 moreNumbers.copy(numbers);  // duplicates numbers &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;isclass()&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Used in the declaration of a new class identifier&lt;br /&gt;
 class MyScript isclass Vehicle {&lt;br /&gt;
   classMethods();&lt;br /&gt;
 };&lt;br /&gt;
*Used to test whether a given reference is to a specific class.&lt;br /&gt;
 given the declaration: &lt;br /&gt;
 TrackLoadInfo info = new TrackLoadInfo();&lt;br /&gt;
 &lt;br /&gt;
 info.isclass(TrackLoadInfo);               // returns true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;new&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Creates a new instance of the specified type. &lt;br /&gt;
 int[] numbers = new int[4];                // creates an integer array containing 4 members. &lt;br /&gt;
 TrackLoadInfo info = new TrackLoadInfo();  // creates a new instance of the TrackLoadInfo class.&lt;br /&gt;
*new does not initialise the members.&lt;br /&gt;
*GameObject classes cannot be created using new.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (4), Multiplication &amp;amp; Division==&lt;br /&gt;
{{MethodHeader|*}}&lt;br /&gt;
*Multiplication. &lt;br /&gt;
*If both terms are integers the result will be an integer.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
 2 * 5 = 10;&lt;br /&gt;
 2 * 5.0 = 10.0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|/}}&lt;br /&gt;
*Division. &lt;br /&gt;
*If both terms are integers the result will be an integer, possibly with a remainder.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
 10 / 5 = 2;&lt;br /&gt;
 10 / 5.0 = 2.0;&lt;br /&gt;
 10 / 6 = 1;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|%}}&lt;br /&gt;
*Remainder or modulus operator.&lt;br /&gt;
*Returns the remainder from an integer division.&lt;br /&gt;
 5 % 2 = 1;&lt;br /&gt;
 105 % 50 = 5;&lt;br /&gt;
 105 % 100 = 5;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (5), Addition &amp;amp; Subtraction==&lt;br /&gt;
{{MethodHeader|+}}&lt;br /&gt;
*Addition&lt;br /&gt;
*If both terms are integers the result will be an integer.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
*If either term is a string the result will be a string.&lt;br /&gt;
 1 + 1 = 2;&lt;br /&gt;
 1 + 1.0 = 2.0;&lt;br /&gt;
 &amp;quot;a&amp;quot; + &amp;quot;b&amp;quot; = &amp;quot;ab&amp;quot;;&lt;br /&gt;
 &amp;quot;a&amp;quot; + 1 = &amp;quot;a1&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|-}}&lt;br /&gt;
*Subtraction&lt;br /&gt;
*If both terms are integers the result will be an integer.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
 2 - 1 = 1;&lt;br /&gt;
 2 - 1.0 = 1.0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (6), Shifts==&lt;br /&gt;
{{MethodHeader|&amp;lt;&amp;lt;}}&lt;br /&gt;
*Shift Left&lt;br /&gt;
*Bitwise operator moves all of the binary values to the left by the number of places specified in the second term.&lt;br /&gt;
*Binary zero is appended.&lt;br /&gt;
*Provided there is no overflow the result is a doubling of the value for each shift. &lt;br /&gt;
 8 &amp;lt;&amp;lt; 1 = 16&lt;br /&gt;
 8 &amp;lt;&amp;lt; 2 = 32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;gt;&amp;gt;}}&lt;br /&gt;
*Shift Right&lt;br /&gt;
*Bitwise operator moves all of the binary values one place to the right by the number of places specified in the second term.&lt;br /&gt;
*Binary zero is prepended and any displaced bits are discarded.&lt;br /&gt;
*The result is an integral halving of the value for each shift. &lt;br /&gt;
 8 &amp;gt;&amp;gt; 1 = 4&lt;br /&gt;
 9 &amp;gt;&amp;gt; 2 = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (7), Comparisons==&lt;br /&gt;
{{MethodHeader|&amp;lt;}}&lt;br /&gt;
* Is less than.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is less than the second.&lt;br /&gt;
 1 &amp;lt; 2 = true;&lt;br /&gt;
 false &amp;lt; false = false;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;lt; &amp;quot;def&amp;quot; = true;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;&amp;amp;#061;}}&lt;br /&gt;
*Is less than or equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is less than or equal to the second.&lt;br /&gt;
 1 &amp;lt;= 2 = true;&lt;br /&gt;
 false &amp;lt;= false = true;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;lt;= &amp;quot;def&amp;quot; = true;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;gt;}}&lt;br /&gt;
*Is greater than.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is greater than the second.&lt;br /&gt;
 1 &amp;gt; 2 = false;&lt;br /&gt;
 true &amp;gt; false = true;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;gt; &amp;quot;def&amp;quot; = false;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;gt;&amp;amp;#061;}}&lt;br /&gt;
*Is greater than or equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is greater than or equal to the second.&lt;br /&gt;
 1 &amp;gt;= 2 = false;&lt;br /&gt;
 true &amp;gt;= true = true;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;gt;= &amp;quot;def&amp;quot; = false;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (8), Equality==&lt;br /&gt;
{{MethodHeader|&amp;amp;#061;&amp;amp;#061;}}&lt;br /&gt;
*Is equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values and on object references.&lt;br /&gt;
*Returns true if the first and second terms are equal or if they evaluate to the same object.&lt;br /&gt;
 int a = 0;&lt;br /&gt;
 int b = 0;&lt;br /&gt;
 a == b;  // returns true&lt;br /&gt;
*Note that &#039;&#039;a = b&#039;&#039; is an assignment and will always return true. Mistyping &#039;&#039;&#039;&#039;&#039;=&#039;&#039;&#039;&#039;&#039; for &#039;&#039;&#039;&#039;&#039;==&#039;&#039;&#039;&#039;&#039; is one of the most common semantic errors in Trainzscript.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|!&amp;amp;#061;}}&lt;br /&gt;
*Is not equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values and on object references.&lt;br /&gt;
*Returns true if the first and second terms are not equal and do not evaluate to the same object.&lt;br /&gt;
 int a = 0;&lt;br /&gt;
 int b = 0;&lt;br /&gt;
 a != b;  // returns false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (9), Bitwise Operators==&lt;br /&gt;
{{MethodHeader|&amp;amp;}}&lt;br /&gt;
*Bitwise AND&lt;br /&gt;
*Performs a bit by bit comparison of two integers and returns a new value.&lt;br /&gt;
*Each bit in the result is set if BOTH of the corresponding bits in the arguments are set&lt;br /&gt;
   0000 1111&lt;br /&gt;
 &amp;amp; 0001 0111&lt;br /&gt;
 = 0000 0111&lt;br /&gt;
&lt;br /&gt;
 15 &amp;amp; 23 = 7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|^}}&lt;br /&gt;
*Bitwise XOR&lt;br /&gt;
*Performs a bit by bit comparison of two integers and returns a new value.&lt;br /&gt;
*Each bit in the result is set if EITHER BUT NOT BOTH of the corresponding bits in the arguments are set&lt;br /&gt;
   0000 1111&lt;br /&gt;
 ^ 0001 0111&lt;br /&gt;
 = 0001 1000&lt;br /&gt;
&lt;br /&gt;
 15 ^ 23 = 24&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;amp;#166;}}&lt;br /&gt;
*Bitwise OR&lt;br /&gt;
*Performs a bit by bit comparison of two integers and returns a new value.&lt;br /&gt;
*Each bit in the result is set if EITHER of the corresponding bits in the arguments are set&lt;br /&gt;
   0000 1111&lt;br /&gt;
 | 0001 0111&lt;br /&gt;
 = 0001 1111&lt;br /&gt;
&lt;br /&gt;
 15 | 23 = 31&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|~}}&lt;br /&gt;
*Bitwise Inverse&lt;br /&gt;
*Takes the binary representation of the integer and inverts each bit.&lt;br /&gt;
*Useful in masking out values from bitfields (eg.  flags &amp;amp;= ~SOME_FLAG;  switches off the SOME_FLAG bit from &#039;flags&#039;)&lt;br /&gt;
 ~0011 1101 = 1100 0010&lt;br /&gt;
 ~1000 0100 = 0111 1011&lt;br /&gt;
&lt;br /&gt;
 ~0   = -1&lt;br /&gt;
 ~255 = -256&lt;br /&gt;
 ~5   = -6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (10), Logical Operators==&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;and&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Logical AND&lt;br /&gt;
*Enables multiple boolean expressions to be combined.&lt;br /&gt;
 if (msg.minor == &amp;quot;Enter&amp;quot; and doorsOpen)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;or&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Logical OR&lt;br /&gt;
*Enables multiple boolean expressions to be combined.&lt;br /&gt;
 if (msg.minor == &amp;quot;Enter&amp;quot; or doorsOpen)&lt;br /&gt;
 if ((msg.minor == &amp;quot;Enter&amp;quot; and doorsOpen) or (msg.minor == &amp;quot;Leave&amp;quot; and !doorsOpen))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (11), Assignment==&lt;br /&gt;
{{MethodHeader|&amp;amp;#061;}}&lt;br /&gt;
*Assignment Operator&lt;br /&gt;
 a = 1;&lt;br /&gt;
 Train train = World.GetTrainList()[0];&lt;br /&gt;
&lt;br /&gt;
The assignment operator sets the variable on the LHS of the expression to the same value as the variable on the RHS.&lt;br /&gt;
&lt;br /&gt;
Note that string and array are object types, not primitive types.  Therefore, like all objects, assignment of a string or array object means that the variable on the LHS of the assignment expression refers to the same object (that is, the same string or the same array) as the variable on the RHS. A new copy of the object is not created.  If the intention is to make an assignment to a new object that is a copy of the original, you should use the .copy() method of the string or array objects, or the .clone() method (if available) of other objects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|,}}&lt;br /&gt;
*Expression or parameter separator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Keywords&amp;diff=26578</id>
		<title>TrainzScript Keywords</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=TrainzScript_Keywords&amp;diff=26578"/>
		<updated>2020-12-28T14:09:00Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add links between language reference pages&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;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keywords==&lt;br /&gt;
__NOEDITSECTION__&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;
 &lt;br /&gt;
 for (n = 0; n &amp;lt; list.size(); n++) {&lt;br /&gt;
   if (n &amp;gt; 5) 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;
    switch(i) {&lt;br /&gt;
       case 0 :  dayOfWeek = &amp;quot;Sunday&amp;quot;;&lt;br /&gt;
                 break;&lt;br /&gt;
       case 1 :  dayOfWeek = &amp;quot;Monday&amp;quot;;&lt;br /&gt;
                 break;&lt;br /&gt;
       case 2 :  dayOfWeek = &amp;quot;Tuesday&amp;quot;;&lt;br /&gt;
                 break;&lt;br /&gt;
       case 3 :  dayOfWeek = &amp;quot;Wednesday&amp;quot;;&lt;br /&gt;
                 break;&lt;br /&gt;
       case 4 :  dayOfWeek = &amp;quot;Thursday&amp;quot;;&lt;br /&gt;
                 break;&lt;br /&gt;
       case 5 :  dayOfWeek = &amp;quot;Friday&amp;quot;;&lt;br /&gt;
                 break;&lt;br /&gt;
       case 6 :  dayOfWeek = &amp;quot;Saturday&amp;quot;;&lt;br /&gt;
                 break;&lt;br /&gt;
       default : dayOfWeek = &amp;quot;ERROR&amp;quot;;&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 immedaitely 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;
  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;
    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;
   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;
   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;
 int i;&lt;br /&gt;
 Junction[] junctions = World.GetJunctionList();&lt;br /&gt;
 for (i = 0; i &amp;lt; junctions.size(); i++) {&lt;br /&gt;
    string name = junctions[i].GetName();&lt;br /&gt;
    Interface.Print(&amp;quot;Junction &amp;quot; + i + &amp;quot; is called &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;
 A: // label statement&lt;br /&gt;
 Interface.Print(&amp;quot;hello&amp;quot;);&lt;br /&gt;
 if(i--) goto 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;
    Interface.Print(&amp;quot;i is 0&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else if (i == 1) {&lt;br /&gt;
    Interface.Print(&amp;quot;i is 1&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 else {&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;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 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 game 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 delete the reference to that object.&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 from outside the current class.&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&lt;br /&gt;
    public string surname;               // public member&lt;br /&gt;
    public string GetName(void) {        // public method&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;
       if (!owner.forename) owner.forename = &amp;quot;Fred&amp;quot;;&lt;br /&gt;
       if (!owner.surname) 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 doorsOpen = false;&lt;br /&gt;
 &lt;br /&gt;
   public void Init(void) {&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;
      while (doorsOpen) {&lt;br /&gt;
         Sleep(0.35 + World.Play2DSound(GetAsset(),&amp;quot;bell.wav&amp;quot;));&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   void ObjectHandler(Message msg) {&lt;br /&gt;
      if (msg.minor == &amp;quot;Enter&amp;quot;) {&lt;br /&gt;
         doorsOpen = true;&lt;br /&gt;
         RingTheBell();&lt;br /&gt;
      }&lt;br /&gt;
      else doorsOpen = false;&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, irrespective of other code within the class.&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;
    on &amp;quot;hello&amp;quot;, &amp;quot;world&amp;quot; : {&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;
       // 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;
   Interface.Print(&amp;quot;i is greater than zero&amp;quot;);&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Types&amp;diff=26577</id>
		<title>Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Types&amp;diff=26577"/>
		<updated>2020-12-28T14:08:52Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add links between language reference pages&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;
&lt;br /&gt;
== Types ==&lt;br /&gt;
&lt;br /&gt;
{{anchor|bool}}{{MethodHeader|bool}}&lt;br /&gt;
*Contains the Boolean constants &#039;&#039;true&#039;&#039; or &#039;&#039;false&#039;&#039;&lt;br /&gt;
*Casting an integer of value 0 to a bool will result in &#039;&#039;false&#039;&#039;, any other value will result in &#039;&#039;true&#039;&#039;.&lt;br /&gt;
 !false = true&lt;br /&gt;
 (bool) 0 = false&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{anchor|int}}{{MethodHeader|int}}&lt;br /&gt;
*32 bit integer&lt;br /&gt;
*Range from -2147483647 .. 2147483647&lt;br /&gt;
 Formats&lt;br /&gt;
 100&lt;br /&gt;
 +100&lt;br /&gt;
 -100&lt;br /&gt;
 0x0f (Tested only in T:ANE)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{anchor|float}}{{MethodHeader|float}}&lt;br /&gt;
*32 bit floating number&lt;br /&gt;
 Formats&lt;br /&gt;
 1.0&lt;br /&gt;
 1.0f&lt;br /&gt;
 polish notation?&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{anchor|object}}{{MethodHeader|object}}&lt;br /&gt;
*&#039;&#039;object&#039;&#039; is a base class which may be used to store references to objects of any class.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{anchor|string}}{{MethodHeader|string}}&lt;br /&gt;
*Strings can be indexed as arrays.&lt;br /&gt;
*Strings support the following escape sequences&lt;br /&gt;
 \r   ?&lt;br /&gt;
 \n   New line&lt;br /&gt;
 \t   Tab character&lt;br /&gt;
 \l   ?&lt;br /&gt;
 \a   ?&lt;br /&gt;
 \b   ?&lt;br /&gt;
 \\   Backslash&lt;br /&gt;
 \&amp;quot;   Double quote mark&lt;br /&gt;
 \&#039;   Single quote mark&lt;br /&gt;
 \0   ?&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{anchor|Array}}{{MethodHeader|Array Types}}&lt;br /&gt;
*Arrays are indexed lists of any base type or any class type including GameObjects.&lt;br /&gt;
*Arrays are declared using these statements&lt;br /&gt;
 Train[] trains;&lt;br /&gt;
 int[] Numbers = new int[n]; // where &#039;&#039;n&#039;&#039; is the number of items in the array.&lt;br /&gt;
*The keyword &#039;&#039;new&#039;&#039; creates the array but does not initialise any of the members&lt;br /&gt;
 Numbers[3] = 256; // assigns a value to the array. Array indices start at zero&lt;br /&gt;
*Arrays may also be returned by methods&lt;br /&gt;
 Signal[] signals = World.GetSignalList()  // creates an array of signals from a built in method&lt;br /&gt;
 Numbers[Numbers.size()] = 5;              // adds a new value after the end of the array, increasing its size by 1&lt;br /&gt;
 Numbers[0,1] = null;                      // deletes the first value from the array, decreasing its size by 1&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Comments_%26_Delineation&amp;diff=26576</id>
		<title>Comments &amp; Delineation</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Comments_%26_Delineation&amp;diff=26576"/>
		<updated>2020-12-28T14:08:48Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add links between language reference pages&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;
==Comments==&lt;br /&gt;
{{MethodHeader|//}}&lt;br /&gt;
*Single line comment, text before the next carriage return will be ignored by the compiler.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|/* */}}&lt;br /&gt;
*Block comment. &lt;br /&gt;
*Text between the two character pairs &#039;/*&#039; and &#039;*/&#039; will be ignored. &lt;br /&gt;
*This convention can be used to temporarily disable the execution of sections of code. &lt;br /&gt;
*Block comment tags cannot be nested but they can enclose single line comments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Delineation==&lt;br /&gt;
{{MethodHeader|:}}&lt;br /&gt;
*Marks the end of a label declaration.&lt;br /&gt;
*see &#039;&#039;on, switch, case, default, label&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|;}}&lt;br /&gt;
*Marks the end of a statement.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|{ } }}&lt;br /&gt;
*Delineates the extent of a compound statement or method declaration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|{ };}}&lt;br /&gt;
*Delineates the extent of a class declaration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Operators&amp;diff=26575</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Operators&amp;diff=26575"/>
		<updated>2020-12-28T14:08:40Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add links between language reference pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The operator sections set out below follow the language&#039;s preference rules. The earlier the operator appears in the list, the higher the precedence and the earlier the listed operators will be evaluated.&lt;br /&gt;
&lt;br /&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;
&lt;br /&gt;
__NOEDITSECTION__&lt;br /&gt;
==Operators (1), Grouping &amp;amp; Indexing==&lt;br /&gt;
{{MethodHeader|( )}}&lt;br /&gt;
*Expression grouping. &lt;br /&gt;
*In common with most programming languages Trainzscript carries out arithmetical operations in the order defined by operator precedence rules.&lt;br /&gt;
*&#039;&#039;3 + 2 * 12 - 7&#039;&#039; would return 20, because multiplication is of higher precedence than addition and subtraction.&lt;br /&gt;
*You can force the compiler to change this sequence and make your intentions crystal clear by declaring this as &#039;&#039;((3 + 2) * 12) - 7&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ i ]}}&lt;br /&gt;
*Array and string indexing.  &lt;br /&gt;
*Arrays are zero based and &#039;&#039;arrayName[0]&#039;&#039; will represent the first element.  &lt;br /&gt;
*Similarly &#039;&#039;arrayName[arrayName.size() - 1]&#039;&#039; will represent the last element.  &lt;br /&gt;
*A call to a value outside the range &#039;&#039;[0 … size()-1]&#039;&#039; will generate an exception. &lt;br /&gt;
*This notation can also be used to return a single character from a string.&lt;br /&gt;
&lt;br /&gt;
 intArray[intArray.size()] = 5    // will add the new value of 5 to the end of the array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ i , j ]}}&lt;br /&gt;
*Array and String range index. &lt;br /&gt;
*The expression &#039;&#039;string[0,string.size()]&#039;&#039; will return the entire string.  &lt;br /&gt;
*The integers i and j are best thought of as &#039;cursor&#039; positions where i is the first element and j is one beyond the last element. &lt;br /&gt;
*If i is omitted the range will start at the beginning of the array (index 0). &lt;br /&gt;
*If j is omitted the range will end after the end of the array (.size()). &lt;br /&gt;
*To return a single element other than the first or last, both i and j are required. &lt;br /&gt;
*Given the declaration &#039;&#039;string s = &amp;quot;abcde&amp;quot;&#039;&#039;&lt;br /&gt;
 s[,3]  = &amp;quot;abc&amp;quot;&lt;br /&gt;
 s[2,3] = &amp;quot;c&amp;quot;&lt;br /&gt;
 s[2,]  = &amp;quot;cde&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 intArray[2,3] = null             // will delete the third element of the array.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ i , ]}}&lt;br /&gt;
*Indexes from i to the end of the string or array inclusively.&lt;br /&gt;
 s[2,]  = &amp;quot;cde&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|[ , j ]}}&lt;br /&gt;
*Indexes from the start of the string or array to element j-1 inclusively.&lt;br /&gt;
 s[,3]  = &amp;quot;abc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|.}}&lt;br /&gt;
*Dereference operator&lt;br /&gt;
 GetAsset().GetConfigSoup();&lt;br /&gt;
*The &#039;&#039;GetConfigSoup()&#039;&#039; method to be called is the method defined for the class &#039;&#039;GetAsset()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|!}}&lt;br /&gt;
*Not Operator&lt;br /&gt;
 !true = false&lt;br /&gt;
 !vehicle = null&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (2), Incremental and Unary Operators==&lt;br /&gt;
{{MethodHeader|++}}&lt;br /&gt;
*Increments a numeric value by 1.&lt;br /&gt;
*Often used for control variables in loops:&lt;br /&gt;
 for(n = 0; n &amp;lt; list.size(); n++) {&lt;br /&gt;
    DoStuffWith(n);&lt;br /&gt;
 }&lt;br /&gt;
*Increments n by 1 on each pass through the loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|--}}&lt;br /&gt;
*Decrements a numeric value by 1.&lt;br /&gt;
*Often used for control variables in loops:&lt;br /&gt;
 n = list.size() - 1;&lt;br /&gt;
 while(n &amp;gt;= 0) {&lt;br /&gt;
    DoStuffWith(n);&lt;br /&gt;
    n--;&lt;br /&gt;
 }&lt;br /&gt;
*Decrements n by 1 on each pass through the loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|+}}&lt;br /&gt;
*Unary plus.&lt;br /&gt;
*Used to denote that a value is positive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|-}}&lt;br /&gt;
*Unary minus.&lt;br /&gt;
*Used to denote that a value is negative.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (3), Casts==&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(bool)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Boolean type cast.&lt;br /&gt;
 (bool) 0 = false&lt;br /&gt;
 (bool) 0.0 = false&lt;br /&gt;
 (bool) n = true     //where n is greater than zero&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(int)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Integer type cast.&lt;br /&gt;
 (int) 5.0 = 5&lt;br /&gt;
 (int) true = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(float)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Float type cast.&lt;br /&gt;
 (float) 100 = 100.0&lt;br /&gt;
 (float) false = 0.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;(string)&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*String type cast.&lt;br /&gt;
 (string) 1 = &amp;quot;1&amp;quot;&lt;br /&gt;
 (string) 0.99 = &amp;quot;0.99&amp;quot;&lt;br /&gt;
 (string) false = &amp;quot;false&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|(&#039;&#039;reference&#039;&#039;)}}&lt;br /&gt;
*Class type cast.&lt;br /&gt;
 &amp;lt;font color=red&amp;gt;How is this used and how is it different from cast&amp;lt;Class&amp;gt;?&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;cast&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Dynamic cast.  &lt;br /&gt;
*Returns null if the reference cannot be converted to the class specified by className.  &lt;br /&gt;
*Note that ancestors of the specified class will be returned.&lt;br /&gt;
 Vehicle vehicle = cast&amp;lt;Vehicle&amp;gt;msg.src;&lt;br /&gt;
 &lt;br /&gt;
 MeshObject meshObject;&lt;br /&gt;
 GameObject gameObject = cast&amp;lt;GameObject&amp;gt;meshObject;  // returns meshObject if the object exists, null otherwise&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;size()&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Returns the number of members of an array or the length of a string.  &lt;br /&gt;
*In the case of an array this does not necessarily mean that all (or any) of the members actually contain values.&lt;br /&gt;
 given string s = &amp;quot;abcde&amp;quot;;&lt;br /&gt;
 s.size() = 5;&lt;br /&gt;
 &lt;br /&gt;
 int[] numbers = new int[5];       // creates an empty array of 5 integers&lt;br /&gt;
 numbers.size() = 5;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;copy()&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Creates a copy of an array or string. &lt;br /&gt;
*This is different from a simple assignment which points a variable to the same memory address as an existing variable.&lt;br /&gt;
*Array.copy() or string.copy() creates an additional copy of the data.&lt;br /&gt;
 int[] numbers = new int[5];&lt;br /&gt;
 int[] moreNumbers;&lt;br /&gt;
 &lt;br /&gt;
 moreNumbers.copy(numbers);  // duplicates numbers &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;isclass()&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Used in the declaration of a new class identifier&lt;br /&gt;
 class MyScript isclass Vehicle {&lt;br /&gt;
   classMethods();&lt;br /&gt;
 };&lt;br /&gt;
*Used to test whether a given reference is to a specific class.&lt;br /&gt;
 given the declaration: &lt;br /&gt;
 TrackLoadInfo info = new TrackLoadInfo();&lt;br /&gt;
 &lt;br /&gt;
 info.isclass(TrackLoadInfo);               // returns true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;new&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Creates a new instance of the specified type. &lt;br /&gt;
 int[] numbers = new int[4];                // creates an integer array containing 4 members. &lt;br /&gt;
 TrackLoadInfo info = new TrackLoadInfo();  // creates a new instance of the TrackLoadInfo class.&lt;br /&gt;
*new does not initialise the members.&lt;br /&gt;
*GameObject classes cannot be created using new.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (4), Multiplication &amp;amp; Division==&lt;br /&gt;
{{MethodHeader|*}}&lt;br /&gt;
*Multiplication. &lt;br /&gt;
*If both terms are integers the result will be an integer.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
 2 * 5 = 10;&lt;br /&gt;
 2 * 5.0 = 10.0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|/}}&lt;br /&gt;
*Division. &lt;br /&gt;
*If both terms are integers the result will be an integer, possibly with a remainder.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
 10 / 5 = 2;&lt;br /&gt;
 10 / 5.0 = 2.0;&lt;br /&gt;
 10 / 6 = 1;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|%}}&lt;br /&gt;
*Remainder or modulus operator.&lt;br /&gt;
*Returns the remainder from an integer division.&lt;br /&gt;
 5 % 2 = 1;&lt;br /&gt;
 105 % 50 = 5;&lt;br /&gt;
 105 % 100 = 5;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (5), Addition &amp;amp; Subtraction==&lt;br /&gt;
{{MethodHeader|+}}&lt;br /&gt;
*Addition&lt;br /&gt;
*If both terms are integers the result will be an integer.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
 1 + 1 = 2;&lt;br /&gt;
 1 + 1.0 = 2.0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|-}}&lt;br /&gt;
*Subtraction&lt;br /&gt;
*If both terms are integers the result will be an integer.&lt;br /&gt;
*If either term is a float the result will be a float.&lt;br /&gt;
 2 - 1 = 1;&lt;br /&gt;
 2 - 1.0 = 1.0;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (6), Shifts==&lt;br /&gt;
{{MethodHeader|&amp;lt;&amp;lt;}}&lt;br /&gt;
*Shift Left&lt;br /&gt;
*Bitwise operator moves all of the binary values to the left by the number of places specified in the second term.&lt;br /&gt;
*Binary zero is appended.&lt;br /&gt;
*Provided there is no overflow the result is a doubling of the value for each shift. &lt;br /&gt;
 8 &amp;lt;&amp;lt; 1 = 16&lt;br /&gt;
 8 &amp;lt;&amp;lt; 2 = 32&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;gt;&amp;gt;}}&lt;br /&gt;
*Shift Right&lt;br /&gt;
*Bitwise operator moves all of the binary values one place to the right by the number of places specified in the second term.&lt;br /&gt;
*Binary zero is prepended and any displaced bits are discarded.&lt;br /&gt;
*The result is an integral halving of the value for each shift. &lt;br /&gt;
 8 &amp;gt;&amp;gt; 1 = 4&lt;br /&gt;
 9 &amp;gt;&amp;gt; 2 = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (7), Comparisons==&lt;br /&gt;
{{MethodHeader|&amp;lt;}}&lt;br /&gt;
* Is less than.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is less than the second.&lt;br /&gt;
 1 &amp;lt; 2 = true;&lt;br /&gt;
 false &amp;lt; false = false;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;lt; &amp;quot;def&amp;quot; = true;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;&amp;amp;#061;}}&lt;br /&gt;
*Is less than or equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is less than or equal to the second.&lt;br /&gt;
 1 &amp;lt;= 2 = true;&lt;br /&gt;
 false &amp;lt;= false = true;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;lt;= &amp;quot;def&amp;quot; = true;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;gt;}}&lt;br /&gt;
*Is greater than.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is greater than the second.&lt;br /&gt;
 1 &amp;gt; 2 = false;&lt;br /&gt;
 true &amp;gt; false = true;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;gt; &amp;quot;def&amp;quot; = false;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;gt;&amp;amp;#061;}}&lt;br /&gt;
*Is greater than or equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values.&lt;br /&gt;
*Returns true if the first term is greater than or equal to the second.&lt;br /&gt;
 1 &amp;gt;= 2 = false;&lt;br /&gt;
 true &amp;gt;= true = true;&lt;br /&gt;
 &amp;quot;abc&amp;quot; &amp;gt;= &amp;quot;def&amp;quot; = false;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (8), Equality==&lt;br /&gt;
{{MethodHeader|&amp;amp;#061;&amp;amp;#061;}}&lt;br /&gt;
*Is equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values and on object references.&lt;br /&gt;
*Returns true if the first and second terms are equal or if they evaluate to the same object.&lt;br /&gt;
 int a = 0;&lt;br /&gt;
 int b = 0;&lt;br /&gt;
 a == b;  // returns true&lt;br /&gt;
*Note that &#039;&#039;a = b&#039;&#039; is an assignment and will always return true. Mistyping &#039;&#039;&#039;&#039;&#039;=&#039;&#039;&#039;&#039;&#039; for &#039;&#039;&#039;&#039;&#039;==&#039;&#039;&#039;&#039;&#039; is one of the most common semantic errors in Trainzscript.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|!&amp;amp;#061;}}&lt;br /&gt;
*Is not equal.&lt;br /&gt;
*Comparison operator which can be used on string, float, integer and bool values and on object references.&lt;br /&gt;
*Returns true if the first and second terms are not equal and do not evaluate to the same object.&lt;br /&gt;
 int a = 0;&lt;br /&gt;
 int b = 0;&lt;br /&gt;
 a != b;  // returns false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (9), Bitwise Operators==&lt;br /&gt;
{{MethodHeader|&amp;amp;}}&lt;br /&gt;
*Bitwise AND&lt;br /&gt;
*Performs a bit by bit comparison of two integers and returns a new value.&lt;br /&gt;
*Each bit in the result is set if BOTH of the corresponding bits in the arguments are set&lt;br /&gt;
   0000 1111&lt;br /&gt;
 &amp;amp; 0001 0111&lt;br /&gt;
 = 0000 0111&lt;br /&gt;
&lt;br /&gt;
 15 &amp;amp; 23 = 7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|^}}&lt;br /&gt;
*Bitwise XOR&lt;br /&gt;
*Performs a bit by bit comparison of two integers and returns a new value.&lt;br /&gt;
*Each bit in the result is set if EITHER BUT NOT BOTH of the corresponding bits in the arguments are set&lt;br /&gt;
   0000 1111&lt;br /&gt;
 ^ 0001 0111&lt;br /&gt;
 = 0001 1000&lt;br /&gt;
&lt;br /&gt;
 15 ^ 23 = 24&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;amp;#166;}}&lt;br /&gt;
*Bitwise OR&lt;br /&gt;
*Performs a bit by bit comparison of two integers and returns a new value.&lt;br /&gt;
*Each bit in the result is set if EITHER of the corresponding bits in the arguments are set&lt;br /&gt;
   0000 1111&lt;br /&gt;
 | 0001 0111&lt;br /&gt;
 = 0001 1111&lt;br /&gt;
&lt;br /&gt;
 15 | 23 = 31&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|~}}&lt;br /&gt;
*Bitwise Inverse&lt;br /&gt;
*Takes the binary representation of the integer and inverts each bit.&lt;br /&gt;
*Useful in masking out values from bitfields (eg.  flags &amp;amp;= ~SOME_FLAG;  switches off the SOME_FLAG bit from &#039;flags&#039;)&lt;br /&gt;
 ~0011 1101 = 1100 0010&lt;br /&gt;
 ~1000 0100 = 0111 1011&lt;br /&gt;
&lt;br /&gt;
 ~0   = -1&lt;br /&gt;
 ~255 = -256&lt;br /&gt;
 ~5   = -6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (10), Logical Operators==&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;and&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Logical AND&lt;br /&gt;
*Enables multiple boolean expressions to be combined.&lt;br /&gt;
 if (msg.minor == &amp;quot;Enter&amp;quot; and doorsOpen)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|&amp;lt;h5&amp;gt;or&amp;lt;/h5&amp;gt;}}&lt;br /&gt;
*Logical OR&lt;br /&gt;
*Enables multiple boolean expressions to be combined.&lt;br /&gt;
 if (msg.minor == &amp;quot;Enter&amp;quot; or doorsOpen)&lt;br /&gt;
 if ((msg.minor == &amp;quot;Enter&amp;quot; and doorsOpen) or (msg.minor == &amp;quot;Leave&amp;quot; and !doorsOpen))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators (11), Assignment==&lt;br /&gt;
{{MethodHeader|&amp;amp;#061;}}&lt;br /&gt;
*Assignment Operator&lt;br /&gt;
 a = 1;&lt;br /&gt;
 Train train = World.GetTrainList()[0];&lt;br /&gt;
&lt;br /&gt;
The assignment operator sets the variable on the LHS of the expression to the same value as the variable on the RHS.&lt;br /&gt;
&lt;br /&gt;
Note that string and array are object types, not primitive types.  Therefore, like all objects, assignment of a string or array object means that the variable on the LHS of the assignment expression refers to the same object (that is, the same string or the same array) as the variable on the RHS. A new copy of the object is not created.  If the intention is to make an assignment to a new object that is a copy of the original, you should use the .copy() method of the string or array objects, or the .clone() method (if available) of other objects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{MethodHeader|,}}&lt;br /&gt;
*Expression or parameter separator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Categories=&lt;br /&gt;
[[Category:TrainzScript]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_InterlockingTowerPath&amp;diff=26574</id>
		<title>Class InterlockingTowerPath</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_InterlockingTowerPath&amp;diff=26574"/>
		<updated>2020-12-28T13:51:22Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add standard API hierarchy&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The InterlockingTowerPath class is the script representation of an individual Interlocking Tower &amp;quot;Path&amp;quot;. In this context a path represents the track that a train can take through an Interlocking Tower controlled area. It is defined by a number of trackside objects (signals, junctions and crossings) and the state that those objects must be in to allow the train passage through that path. Each path has an entry and exit signal. When a train approaches an entry signal the Interlocking Tower (and related libraries) will attempt to assign it a specific path, so that it may pass the signal.&lt;br /&gt;
&lt;br /&gt;
*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**[[Class GSObject|GSObject]] *&lt;br /&gt;
***[[Class GameObject|GameObject]]&lt;br /&gt;
****InterlockingTowerPath &lt;br /&gt;
&lt;br /&gt;
==Related Classes==&lt;br /&gt;
* [[Class InterlockingTower|InterlockingTower]]&lt;br /&gt;
* [[Class Signal|Signal]]&lt;br /&gt;
* [[Class Junction|Junction]]&lt;br /&gt;
* [[Class Crossing|Crossing]]&lt;br /&gt;
* [[Class TrackCircuitBlock|TrackCircuitBlock]]&lt;br /&gt;
* [[Class TrackPathDisplay|TrackPathDisplay]]&lt;br /&gt;
&lt;br /&gt;
==Common functions==&lt;br /&gt;
Below is a list of some of the basic common functions on the InterlockingTower script class. This list is not intended to be comprehensive, merely provide an overview.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public mandatory void Init(InterlockingTower tower, SecurityToken token)}}&lt;br /&gt;
;Description&lt;br /&gt;
Initialises the path with the parameters defined, if possible. Will throw an exception and return false if the request is invalid.&lt;br /&gt;
;Parameters&lt;br /&gt;
*tower - The calling interlocking tower.&lt;br /&gt;
*token - A SecurityToken from the owning InterlockingTower, with sufficient rights to activate the path.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void SetPathName(string pathName)}}&lt;br /&gt;
;Description&lt;br /&gt;
Sets the identifying path name. This should be unique within the owning tower.&lt;br /&gt;
;Parameters&lt;br /&gt;
*pathName - The new identifying name for the tower path.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public string GetPathName()}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns the identifying path name for this tower path.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public string GetLocalisedPathName()}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns the localised path name for this tower path. Localised names are stored in the string-table for the route or session. There is no interface to set this and it must be done by the session creator.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public bool IsObjectInPathDefinition(MapObject obj, int childIndex, bool bIncludeExternalRequirements)}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns whether a given object is part of the definition of this path.&lt;br /&gt;
;Parameters&lt;br /&gt;
*obj - The path object (junction, signal, etc) to search for.&lt;br /&gt;
*childIndex - The index of a child object, or -1 for the object itself.&lt;br /&gt;
*bIncludeExternalRequirements - Whether to also check the external requirement list.&lt;br /&gt;
;Returns&lt;br /&gt;
*bool - true if the object was found, false otherwise&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public bool IsObjectOnPath(MapObject obj)}}&lt;br /&gt;
;Description&lt;br /&gt;
Performs a track search and returns whether the passed object is on the path somewhere. Avoid calling this often as it can be quite intensive.&lt;br /&gt;
;Parameters&lt;br /&gt;
*obj - The map object to search the path for.&lt;br /&gt;
;Returns&lt;br /&gt;
*bool - Whether the object was found on the path.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public bool IsObjectOnOrBeyondPath(MapObject obj)}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns whether a given object is on this path, or lies on the track beyond the exit signal. Note that searching beyond the path will follow the currently set junction directions.&lt;br /&gt;
;Parameters&lt;br /&gt;
*obj - The map object to search the path for.&lt;br /&gt;
;Returns&lt;br /&gt;
*bool - Whether the object was found on the path, or within the search range beyond the path.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public int GetPathClearMethod()}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns the currently set path clear method, which is one of the ITP_CLEAR_* defines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void SetPathClearMethod(int clearMethod)}}&lt;br /&gt;
;Description&lt;br /&gt;
Alters the path clear method for this path.&lt;br /&gt;
;Parameters&lt;br /&gt;
*clearMethod - The new clearing method to set, one of the ITP_CLEAR_* defines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|bool CanTransitionPathToState(int state)}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns whether this path is in a state where it&#039;s possible to begin to transition to the state passed. When creating a custom tower script this is an ideal place to perform extra checks for path state changes.&lt;br /&gt;
;Parameters&lt;br /&gt;
*state - The state we want to transition to.&lt;br /&gt;
;Returns&lt;br /&gt;
*bool - true if the path is able to transition to the requested state, false otherwise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void ActivatePath(SecurityToken token)}}&lt;br /&gt;
;Description&lt;br /&gt;
Begins activating the path, if possible. Will post a message to the owning tower of type &amp;quot;InterlockingTowerPath&amp;quot;,&amp;quot;Active&amp;quot; when the path is set.&lt;br /&gt;
;Parameters&lt;br /&gt;
*token - A [[SecurityToken]] from the owning tower with rights &amp;quot;path-control&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void CancelPath(SecurityToken token)}}&lt;br /&gt;
;Description&lt;br /&gt;
Begins cancelling the path, if possible. Will post a message to the owner of type &amp;quot;InterlockingTowerPath&amp;quot;,&amp;quot;Cancelled&amp;quot; when the path is cancelled. This will return all controlled objects to their original state if appropriate, based on m_clearState.&lt;br /&gt;
;Parameters&lt;br /&gt;
*token - A [[SecurityToken]] from the owning tower with rights &amp;quot;path-control&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void SetPanicState(SecurityToken token)}}&lt;br /&gt;
;Description&lt;br /&gt;
Instantly drops all controlled signals along this path. Does not change junction or crossing state. Used to simulate an emergency situation of some kind. To transition out of a panic state call either ActivatePath or CancelPath.&lt;br /&gt;
;Parameters&lt;br /&gt;
*token - A [[SecurityToken]] from the owning tower with rights &amp;quot;path-control&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void AddTrain(SecurityToken token, Train train)}}&lt;br /&gt;
;Description&lt;br /&gt;
Adds the train passed to this path. Does not perform any validation on this operation and will warrant all requests from a valid source.&lt;br /&gt;
;Parameters&lt;br /&gt;
*token - A [[SecurityToken]] from the owning tower with rights &amp;quot;path-control&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void RemoveTrain(SecurityToken token, Train train)}}&lt;br /&gt;
;Description&lt;br /&gt;
Removed the train passed from this path. Performs no validation on the operation and will warrant all requests from a valid source.&lt;br /&gt;
;Parameters&lt;br /&gt;
*token - A [[SecurityToken]] from the owning tower with rights &amp;quot;path-control&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public bool IsOccupiedByTrain(Train train, bool bRequireHasClearedEntrySignal)}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns whether the path is known to be occupied by a specific train. Does not perform any track searching and is reliant on the owning tower correctly calling AddTrain/RemoveTrain.&lt;br /&gt;
;Parameters&lt;br /&gt;
*train - The train to check for.&lt;br /&gt;
*bRequireHasClearedEntrySignal - If true, return true only if the train has cleared the entry signal and is occupying the path, otherwise it&#039;s sufficient that the tower has merely &#039;added&#039; the train.&lt;br /&gt;
;Returns&lt;br /&gt;
*bool - Whether the train has been added to the path and, optionally, has passed the entry signal.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void EnablePathVisualisation(bool enable, bool bShouldIncludeAllTCBs)}}&lt;br /&gt;
;Description&lt;br /&gt;
Enables/disables visualisation of this path in the game world, using [[TrackPathDisplay]].&lt;br /&gt;
;Parameters&lt;br /&gt;
*enable - true to enable the path visualisation, false to disable it&lt;br /&gt;
*bShouldIncludeAllTCBs - Whether to also add path visualisations for every occupied [[TrackCircuitBlock]].&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_InterlockingTower&amp;diff=26573</id>
		<title>Class InterlockingTower</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_InterlockingTower&amp;diff=26573"/>
		<updated>2020-12-28T13:51:13Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Add standard API hierarchy&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The InterlockingTower class is the script representation of an in game Interlocking Tower (aka Signal Tower). Interlocking Towers are used to define track &amp;quot;paths&amp;quot; that trains can travel down.&lt;br /&gt;
&lt;br /&gt;
*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**[[Class GSObject|GSObject]] *&lt;br /&gt;
***[[Class GameObject|GameObject]]&lt;br /&gt;
****[[Class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
*****[[Class MeshObject|MeshObject]]&lt;br /&gt;
*****[[Class PropertyObject|PropertyObject]] *&lt;br /&gt;
******[[Class MapObject|MapObject]]&lt;br /&gt;
*******InterlockingTower&lt;br /&gt;
&lt;br /&gt;
==Related Classes==&lt;br /&gt;
* [[Class InterlockingTowerPath|InterlockingTowerPath]]&lt;br /&gt;
* [[Class Signal|Signal]]&lt;br /&gt;
* [[Class Junction|Junction]]&lt;br /&gt;
* [[Class Crossing|Crossing]]&lt;br /&gt;
* [[Class TrackCircuitBlock|TrackCircuitBlock]]&lt;br /&gt;
* [[Class TrackPathDisplay|TrackPathDisplay]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Common functions==&lt;br /&gt;
Below is a list of some of the basic common functions on the InterlockingTower script class. This list is not intended to be comprehensive, merely provide an overview.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public InterlockingTowerPath CreateNewPath()}}&lt;br /&gt;
;Description&lt;br /&gt;
Creates a new blank path for use by this tower. Any script which needs to create a path should call this function. Any tower which needs to customise the class can then just override this to create their type.&lt;br /&gt;
;Returns&lt;br /&gt;
*InterlockingTowerPath - A newly created and initialised [[InterlockingTowerPath]] object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public string[] GetLocalisedPathNames()}}&lt;br /&gt;
;Description&lt;br /&gt;
Returns a list of the current (localised) path names.&lt;br /&gt;
;Returns&lt;br /&gt;
*string[] - A string array, containing the localised names of every path.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public InterlockingTowerPath FindPathByName(string pathName)}}&lt;br /&gt;
;Description&lt;br /&gt;
Finds and returns an interlocking path by name, or localised name (for the current language).&lt;br /&gt;
;Parameters&lt;br /&gt;
*pathName - The name (or localised name) of the path to find.&lt;br /&gt;
;Returns&lt;br /&gt;
*InterlockingTowerPath - The found [[InterlockingTowerPath]], or null if no match was found.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public InterlockingTowerPath[] GetConflictingPaths(InterlockingTowerPath path)}}&lt;br /&gt;
;Description&lt;br /&gt;
Builds an array of tower paths which have conflicts with the path passed. This will include any other path which shares an object in its path definition or external requirements.&lt;br /&gt;
;Parameters&lt;br /&gt;
*path - The [[InterlockingTowerPath]] to examine and find conflicts for.&lt;br /&gt;
;Returns&lt;br /&gt;
*InterlockingTowerPath[] - An array of tower paths which conflict with the path passed. If no conflicts are found this will be an empty array (i.e. not null).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public mandatory void SetAIState(int aiState)}}&lt;br /&gt;
;Description&lt;br /&gt;
Alters the current state of the towers automatic path selection processing.&lt;br /&gt;
;Parameters&lt;br /&gt;
*aiState - The new AI state for the tower, see PATH_ASSIGNMENT_* defines.&lt;br /&gt;
;Note&lt;br /&gt;
This function is &#039;mandatory&#039;, meaning that any overriding function must call the inherited() in order to compile.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void AssignPathToTrain(Train train, string pathName)}}&lt;br /&gt;
;Description&lt;br /&gt;
Requests a specific path for the specified train. This will create a queue entry for the train if one doesn&#039;t already exist, set it&#039;s state to queued and set the path to that requested. The path may not be prepared immediately, if there are conflicting queued entries.&lt;br /&gt;
;Parameters&lt;br /&gt;
*train - The train to assign the path to.&lt;br /&gt;
*pathName - The name of the path to assign.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void CancelPathForTrain(Train train, string pathName)}}&lt;br /&gt;
;Description&lt;br /&gt;
Cancels a specific path for the train passed. If the train is not known, or there is no InterlockingTrainPath entry for this train and signal, then no action will be taken.&lt;br /&gt;
;Parameters&lt;br /&gt;
*train - The train to cancel the path for.&lt;br /&gt;
*pathName - The name of the path to cancel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void SetPanicStateForPath(string pathName)}}&lt;br /&gt;
;Description&lt;br /&gt;
Sets as specific path to a panic state, dropping all signals immediately, regardless of any occupying or approaching trains.&lt;br /&gt;
;Parameters&lt;br /&gt;
*pathName - The name of the path to set to a panic/emergency state.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;{{MethodHeader|public void SetTrainAsPassing(Train train, Signal entrySignal)}}&lt;br /&gt;
;Description&lt;br /&gt;
Sets a train&#039;s state for a specific entry signal to STATE_PASSING, so the tower knows the train is not entering the interlocking, and will ignore it until it leaves the area. If the train is not known, or there is no InterlockingTrainPath entry for this train and signal, then no action will be taken.&lt;br /&gt;
;Parameters&lt;br /&gt;
*train - The train to set as passing.&lt;br /&gt;
*entrySignal - The path entry signal that the train is passing.&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_Constructors&amp;diff=26572</id>
		<title>Class Constructors</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_Constructors&amp;diff=26572"/>
		<updated>2020-12-28T13:47:30Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Change link to library reference, not language reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**Constructors&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*A static class providing the ability to create instances of certain other classes from script.&lt;br /&gt;
*Trainzscript does not normally allow game classs to be created in script, these methods allow for exceptions to this rule.&lt;br /&gt;
*The implementation is liable to change.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzAsset==&lt;br /&gt;
{{MethodHeader|public native Asset GetTrainzAsset(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The global Trainz asset.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method is used mainly by the built-in classes.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetTrainzStrings==&lt;br /&gt;
{{MethodHeader|public native StringTable GetTrainzStrings(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The global Trainz StringTable.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method is used mainly by the built-in classes.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==NewBrowser==&lt;br /&gt;
{{MethodHeader|public native Browser NewBrowser(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A new empty Browser object.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Browser browser = Constructors.NewBrowser();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==NewDriverCommand==&lt;br /&gt;
{{MethodHeader|public native DriverCommand NewDriverCommand(Asset command)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;command&#039;&#039;&#039; = reference to a &#039;&#039;DriverCommand&#039;&#039; asset from which the new command instance will be constructed.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A new DriverCommand instance for script use.&lt;br /&gt;
;Notes&lt;br /&gt;
*This method does not add a new command to the list of available driver commands returned by World.GetDriverCommandList() but simply creates a script instance for private use. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==NewDriverCommands==&lt;br /&gt;
{{MethodHeader|public native DriverCommands NewDriverCommands(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A new empty DriverCommands list.&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==NewKUIDList==&lt;br /&gt;
{{MethodHeader|public native KUIDList NewKUIDList(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A new KUIDList object, empty and unlocked.&lt;br /&gt;
;Syntax&lt;br /&gt;
 KUIDList consist = Constructors.NewKUIDList();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==NewMenu==&lt;br /&gt;
{{MethodHeader|public native Menu NewMenu(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A new empty Menu object.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Menu menu = Constructors.NewMenu();&lt;br /&gt;
;Notes&lt;br /&gt;
*The menu returned is for setup purposes only, this method does not create any visual representation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==NewProductFilter==&lt;br /&gt;
{{MethodHeader|public native ProdutFilter NewProducFilter(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A new ProdutFlter object, empty and unlocked.&lt;br /&gt;
;Syntax&lt;br /&gt;
 ProductFilter filter = Constructors.NewProductFilter();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==NewSoup==&lt;br /&gt;
{{MethodHeader|public native Soup NewSoup(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A new Soup object, empty and unlocked.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Soup soup = Constructors.NewSoup();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_JunctionBase&amp;diff=26571</id>
		<title>Class JunctionBase</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_JunctionBase&amp;diff=26571"/>
		<updated>2020-12-28T13:47:17Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Change link to library reference, not language reference&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;
****[[Class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[Class PropertyObject|PropertyObject]] *&lt;br /&gt;
*****[[Class MeshObject|MeshObject]]&lt;br /&gt;
******[[Class MapObject|MapObject]]&lt;br /&gt;
*******JunctionBase *&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*Interface methods to control and obtain information about the status of Junction objects.&lt;br /&gt;
*This class relates equally to switch levers controlling spline track junctions and to the junction nodes attached to Fixed Track Junction objects.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants &amp;amp; Messages==&lt;br /&gt;
&lt;br /&gt;
===Junction States===&lt;br /&gt;
*These values define the directions possible through a junction object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int  DIRECTION_LEFT = 0 ||Left junction direction.&lt;br /&gt;
|-&lt;br /&gt;
|public define int  DIRECTION_FORWARD = 1 ||Forward junction direction (straight on for three way points).&lt;br /&gt;
|-&lt;br /&gt;
|public define int  DIRECTION_RIGHT = 2 ||Right junction direction.&lt;br /&gt;
|-&lt;br /&gt;
|public define int  DIRECTION_BACKWARD = -1 ||Backward junction direction (leading approach).&lt;br /&gt;
|-&lt;br /&gt;
|public define int  DIRECTION_NONE = 3 ||No junction direction or error condition.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Messages==&lt;br /&gt;
*Messages sent to and from Junction 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;
|Junction||Toggled||Junction||Broadcast&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Junction]]||Enter||Junction||Train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Junction]]||InnerEnter||Junction||Train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Junction]]||Stopped||Junction||Train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Junction]]||InnerLeave||Junction||Train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Junction]]||Leave||Junction||Train&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||Enter||Train||Junction&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||InnerEnter||Train||Junction&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||Stopped||Train||Junction&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||InnerLeave||Train||Junction&lt;br /&gt;
|-&lt;br /&gt;
|[[Object Messages|Object]]||Leave||Train||Junction&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
===AllowManualControl===&lt;br /&gt;
{{MethodHeader|public native voidAllowManualControl(bool allow)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;allow&#039;&#039;&#039; = True to allow the user to toggle the junction, false otherwise.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax;&lt;br /&gt;
 AllowManualControl(true);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetDebugString===&lt;br /&gt;
{{MethodHeader|public string GetDebugString(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A string that contains the node ID and name of the MapObject associated with this junction. If successful, the returned string will include the node ID and name of the MapObject. Otherwise an error string will be returned instead. &lt;br /&gt;
;Syntax;&lt;br /&gt;
 Interface.Print(GetDebugString());&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetDirection===&lt;br /&gt;
{{MethodHeader|public native int GetDirection(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Junction States|Junction State]] constants indicating the current direction of the junction.&lt;br /&gt;
;Syntax;&lt;br /&gt;
 int direction = GetDirection();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetDirectionToTrain===&lt;br /&gt;
{{MethodHeader|public native int GetDirectionToTrain(Train train)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = A reference to a train located within 15 track stretches of the junction.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*One of the [[#Junction States|Junction State]] constants indicating the track on which the train was found.&lt;br /&gt;
;Syntax;&lt;br /&gt;
 int approachPath = GetDirectionToTrain(train);&lt;br /&gt;
;Notes&lt;br /&gt;
*DIRECTION_NONE is returned if the train is not within range.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetGameObject===&lt;br /&gt;
{{MethodHeader|public native GameObject GetGameObject(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the GameObject associated with this junction.&lt;br /&gt;
;Syntax;&lt;br /&gt;
 GameObject go = junction.GetGameObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*For a trackside spline junction this method returns the junction lever object.&lt;br /&gt;
*For an embedded junction in a fixed track junction the object returned is the embedded junction node.&lt;br /&gt;
*In either case null is returned on failure.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetManualControl===&lt;br /&gt;
{{MethodHeader|public native bool GetManualControl(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the user is allowed to toggle this junction, false otherwise.&lt;br /&gt;
;Syntax;&lt;br /&gt;
 bool locked = !GetManualControl();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetMapObject===&lt;br /&gt;
{{MethodHeader|public native MapObject GetMapObject(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the MapObject associated with this junction.&lt;br /&gt;
;Syntax;&lt;br /&gt;
 MapObject mo = junction.GetMapObject();&lt;br /&gt;
;Notes&lt;br /&gt;
*For a trackside spline junction this method returns the junction lever object.&lt;br /&gt;
*For an embedded junction in a fixed track piece the object returned is the fixed track parent object.&lt;br /&gt;
*In either case null is returned on failure.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===JunctionInnerReEnter===&lt;br /&gt;
{{MethodHeader|public native bool JunctionInnerReEnter(int node)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;node&#039;&#039;&#039; = Node Id of train as returned by Train.GetId().&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax;&lt;br /&gt;
 junction.JunctionInnerReEnter(train);&lt;br /&gt;
;Notes&lt;br /&gt;
*The effect of this method is to cause a new &#039;&#039;Junction,InnerEnter&#039;&#039; message to be sent to the Junction if any part of the train is within the inner trigger radius.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===JunctionReEnter===&lt;br /&gt;
{{MethodHeader|public native bool JunctionReEnter(int node)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;node&#039;&#039;&#039; = Node Id of train as returned by Train.GetId().&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax;&lt;br /&gt;
 junction.JunctionReEnter(train);&lt;br /&gt;
;Notes&lt;br /&gt;
*The effect of this method is to cause a new &#039;&#039;Junction,Enter&#039;&#039; message to be sent to the Junction if any part of the train is within the default outer trigger radius.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RequestPermit===&lt;br /&gt;
{{MethodHeader|public native Permit RequestPermit(GameObject obj)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;obj&#039;&#039;&#039; = Object requesting the [[Class Permit|Permit]].&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a Permit for &#039;&#039;obj&#039;&#039; to control the junction. &lt;br /&gt;
;Syntax;&lt;br /&gt;
 Permit permit = RequestPermit(train);&lt;br /&gt;
;Notes&lt;br /&gt;
*Although a Permit is always returned, it may not necessarily be granted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RequestTrackPermit===&lt;br /&gt;
{{MethodHeader|public native Permit RequestTrackPermit(GameObject obj, int direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;obj&#039;&#039;&#039; = Object requesting the [[Class Permit|Permit]].&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = One of the [[#Junction States|Junction State]] constants indicating the direction of the track relative to the current junction.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*Returns a Permit for &#039;&#039;obj&#039;&#039; to control the specified track. &lt;br /&gt;
;Syntax;&lt;br /&gt;
 Permit permit = RequestTrackPermit(train, DIRECTION_LEFT);&lt;br /&gt;
;Notes&lt;br /&gt;
*Although a Permit is always returned, it may not necessarily be granted.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetDirection===&lt;br /&gt;
{{MethodHeader|public native bool SetDirection (int direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = New direction to set.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the junction is changed, False if the direction is unchanged or if the specified direction was invalid for this junction.&lt;br /&gt;
;Syntax;&lt;br /&gt;
 if (junction.SetDirection(DIRECTION_LEFT)) Interface.Print(&amp;quot;Junction now set to the left&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*This method switches the junction unconditionally, disregarding any Permits that may exist.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SwitchForTrain===&lt;br /&gt;
{{MethodHeader|public native bool SwitchForTrain(Train train, int direction)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;train&#039;&#039;&#039; = Train that is to pass over the junction.&lt;br /&gt;
*&#039;&#039;&#039;direction&#039;&#039;&#039; = One of the [[#Junction States|Junction State]] constants indicating the current position of the train relative junction.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the junction is changed, False if the direction is unchanged or if the specified direction was invalid for this junction.&lt;br /&gt;
;Syntax;&lt;br /&gt;
 junction.SwitchForTrain(train,DIRECTION_BACKWARD);&lt;br /&gt;
;Notes&lt;br /&gt;
*The new direction must be on the opposite side of the junction to the train&#039;s current position.&lt;br /&gt;
*This method switches the junction unconditionally, disregarding any Permits that may exist.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
[[Class SceneryWithTrack#GetAttachedJunctions|SceneryWithTrack.GetAttachedJunctions()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class World#GetJunctionList|World.GetJunctionList()]]&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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_Train&amp;diff=26570</id>
		<title>Class Train</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_Train&amp;diff=26570"/>
		<updated>2020-12-28T13:47:13Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Change link to library reference, not language reference&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 GetAutopilot Mode(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>Danny252</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_Cabin&amp;diff=26569</id>
		<title>Class Cabin</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_Cabin&amp;diff=26569"/>
		<updated>2020-12-28T13:47:05Z</updated>

		<summary type="html">&lt;p&gt;Danny252: Change link to library reference, not language reference&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;
****[[Class TrainzGameObject|TrainzGameObject]]&lt;br /&gt;
****[[Class PropertyObject|PropertyObject]] *&lt;br /&gt;
*****[[Class MeshObject|MeshObject]]&lt;br /&gt;
******Bogey&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
*This class is the interface class used for cabins and interior assets in Trainz.&lt;br /&gt;
*From the scripting perspective, a Cabin is mainly a collection of controls. &lt;br /&gt;
*What controls the cabin has depends on the configuration of the asset. &lt;br /&gt;
*If a cabin asset is to have custom scripted features, it&#039;s script class will need to be derived from this one. &lt;br /&gt;
*The types of controls a cabin has is locomotive specific hence this class is the interface and not a cabin implementation.&lt;br /&gt;
*The DefaultLocomotiveCabin and DefaultSteamCabin classes provide basic default Cabin implementations.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Attach===&lt;br /&gt;
{{MethodHeader|public void Attach(GameObject owner)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;owner&#039;&#039;&#039; = GameObjet to which the cabin will be attached, normally a Locomotive.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
*A callback method used by the game engine when it is about to attach this cabin to an object.&lt;br /&gt;
*A cabin is destroyed when it is no longer needed and re-created by Trainz later on if needed again.&lt;br /&gt;
*This method is where you should restore any saved cabin control settings.&lt;br /&gt;
*A Locomotive object has a cache of cabin control settings that can be saved to when the cabin is updated (see [[Class Locomotive#GetCabinData|Locomotive.GetCabinData()]])&lt;br /&gt;
*The programmer will need to update and make use of cabin settings in their implementation of this method.&lt;br /&gt;
*This gets called &#039;&#039;&#039;after&#039;&#039;&#039; the cabin is fully initialized (after the Init function has run successfully). You can not rely on any information from here to be present during the init.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FireAddCoal===&lt;br /&gt;
{{MethodHeader|public native bool FireAddCoal(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if coal is added successfully, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 FireAddCoal();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetControls===&lt;br /&gt;
{{MethodHeader|public native CabinControl[ ] GetControls(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*An array of the CabinControl objects applicable to the cabin.&lt;br /&gt;
;Syntax&lt;br /&gt;
 CabinControl[] controls = GetControls();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetNamedControl===&lt;br /&gt;
{{MethodHeader|public native CabinControl GetNamedControl(string name)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;name&#039;&#039;&#039; = Name of control to return.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the named control if it exists, null otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 CabinControl control = GetNamedControl(&amp;quot;brake&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===GetParentObject===&lt;br /&gt;
{{MethodHeader|public native GameObject GetParentObject(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*A reference to the parent GameObject to which the cabin is attached, usually a Locomotive.&lt;br /&gt;
;Syntax&lt;br /&gt;
 Locomotive loco = cast&amp;lt;Locomotive&amp;gt;cabin.GetParentObject();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IsActive===&lt;br /&gt;
{{MethodHeader|public native bool IsActive(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*True if the cabin is currently active, false otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 bool cabinExists = cabin.IsActive();&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===SetCabLightIntensity===&lt;br /&gt;
{{MethodHeader|public native void SetCabLightIntensity(float intensity)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;intensity&#039;&#039;&#039; = A normalised lighting level in the range 0.0..1.0&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SetCabLightIntensity(0.5);&lt;br /&gt;
;Notes &lt;br /&gt;
&#039;&#039;It works? In build 4.3 no changes are visible. Should the texture glow turn on?&#039;&#039;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Update===&lt;br /&gt;
{{MethodHeader|public void Update(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
*This is a callback method used by Trainz to update the cabin object.&lt;br /&gt;
*This implementation is empty so the script programmer must implement it if they want their cabin&#039;s controls to be updated.&lt;br /&gt;
*If you want to keep the controls in the cabin up to date and to accurately reflect the current state of the locomotive, you will need to perform those updates from an overridden implementation of this method.&lt;br /&gt;
*This is mostly a case of querying the current status of the host locomotive and applying it to the matching control.&lt;br /&gt;
*The speedometer in the cab for instance should be updated based on the loco&#039;s current velocity.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===UserPressKey===&lt;br /&gt;
{{MethodHeader|public void UserPressKey(string keyName)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;keyName&#039;&#039;&#039; = The name of the key pressed.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
*This is a callback method used by Trainz when the user presses a key.&lt;br /&gt;
*The default Cabin implementation does not handle any keystrokes. You must do so in your own overridden implementation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===UserSetControl===&lt;br /&gt;
{{MethodHeader|public void UserSetControl(CabinControl control, float value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;control&#039;&#039;&#039; = The control that the user has operated.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; = The value to assign as a result of the user&#039;s action.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Notes&lt;br /&gt;
*This is a callback method used by Trainz when the user presses a key.&lt;br /&gt;
*You should override this method to apply the settings selected by the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&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>Danny252</name></author>
	</entry>
</feed>