<?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=Marekp9</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=Marekp9"/>
	<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/wiki/Special:Contributions/Marekp9"/>
	<updated>2026-11-05T10:36:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_PropertyObject&amp;diff=29175</id>
		<title>Class PropertyObject</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_PropertyObject&amp;diff=29175"/>
		<updated>2021-04-05T09:22:03Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* GetDescriptionHTML */ Added link to MiniBrowser with the list of supported HTML elements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**PropertyObject&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This class provides an interface that allows an object to implement properties that can be saved or loaded to a session and edited by the user through a browser window in Surveyor. To enable this for an asset, it must inherit from PropertyObject (or from a derived child class such as [[Class ScenarioBehavior|ScenarioBehavior]] or [[Class MeshObject|MeshObject]]). &lt;br /&gt;
&lt;br /&gt;
PropertyObject operates by way of a series of predefined callback methods which are designed to be overridden by the script writer to allow Trainz to access an object&#039;s properties. Properties are referred to in the class methods by their propertyID. Trainz determines this by reference to links in the object browser in the form &#039;&#039;live://property/propertyID&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
When Trainz is saving a session, it asks each object to save its respective state into a [[Class Soup|Soup]] database. Trainz doesn&#039;t know what your object needs to save, but it does know that it can request an object&#039;s state via callbacks. Trainz relies on the script programmer to give careful thought to what data is needed to save and restore an objects state. &lt;br /&gt;
&lt;br /&gt;
Depending on circumstances, not all callback methods have to be implemented. For example, you don&#039;t need to override [[#GetPropertyElementList|GetPropertyElementList()]] if there are no list-selection properties. &lt;br /&gt;
&lt;br /&gt;
==Callback Sequences==&lt;br /&gt;
The precise sequence of callback method calls will vary with the content of the browser and the user&#039;s input but the following gives a general idea:&lt;br /&gt;
*When the Property Browser is opened Trainz calls:&lt;br /&gt;
** [[#GetProperties|GetProperties()]] to read the current session data.&lt;br /&gt;
** [[#GetDescriptionHTML|GetDescriptionHTML()]] to read the HTML code for the browser configuration window.&lt;br /&gt;
*When the user clicks on a URL, the propertyID is extracted from the link and these calls are made:&lt;br /&gt;
** [[#GetPropertyType|GetPropertyType()]] to establish the &#039;type&#039; of the property is to be edited.&lt;br /&gt;
**For &amp;quot;link&amp;quot; properties Trainz will call:&lt;br /&gt;
*** [[#LinkPropertyValue|LinkPropertyValue()]], which should respond and set the desired value&lt;br /&gt;
**For &amp;quot;string&amp;quot;, &amp;quot;int&amp;quot; and &amp;quot;float&amp;quot; properties:&lt;br /&gt;
*** [[#GetPropertyValue|GetPropertyValue()]] to establish the property&#039;s current value.&lt;br /&gt;
*** [[#GetPropertyName|GetPropertyName()]] and/or [[#GetPropertyDescription|GetPropertyDescription()]] to obtain display info for the UI.&lt;br /&gt;
*** Trainz then provides a pop-up edit box with a caption and current value filled in and waits for the user to edit the property, if desired.&lt;br /&gt;
**For &amp;quot;list&amp;quot; properties:&lt;br /&gt;
*** [[#GetPropertyName|GetPropertyName()]] and/or [[#GetPropertyDescription|GetPropertyDescription()]] to obtain display info for the UI.&lt;br /&gt;
*** [[#GetPropertyElementList|GetPropertyElementList()]] to obtain the list options to display to the player.&lt;br /&gt;
*** Trainz then provides a pop-up edit box with a caption and the list of options and waits for the user to edit the property, if desired.&lt;br /&gt;
**For &amp;quot;map-object&amp;quot; and &amp;quot;asset-list&amp;quot; properties:&lt;br /&gt;
*** [[#GetPropertyName|GetPropertyName()]] and/or [[#GetPropertyDescription|GetPropertyDescription()]] to obtain display info for the UI.&lt;br /&gt;
*** Trainz displays a filterable list dialog to the player, showing a spinner while the search runs.&lt;br /&gt;
*** When a search completes, Trainz calls [[#FilterPropertyElementList|FilterPropertyElementList()]], to allow the script to add/remove any custom entries.&lt;br /&gt;
*Once the user has carried out any edits:&lt;br /&gt;
** The appropriate variant of [[#SetPropertyValue|SetPropertyValue()]] is called to update the value of the property.&lt;br /&gt;
** [[#GetDescriptionHTML|GetDescriptionHTML()]] is called again to refresh the contents of the Browser window for any new configuration.&lt;br /&gt;
*When all edits are complete:&lt;br /&gt;
**If the user confirms their changes and closes the dialog:&lt;br /&gt;
*** [[#SetProperties|SetProperties()]] is called with the modified Soup to update the session database.&lt;br /&gt;
**If the user cancels the changes:&lt;br /&gt;
*** [[#SetProperties|SetProperties()]] is called with the original unaltered Soup to restore the script to it&#039;s original pre-edit state.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Throughout the above sequences Trainz is only concerned with the loading and saving of properties. Wherever a change in a property requires an update to the appearance of the object or to the contents of its variables it is the responsibility of the script writer to implement these changes at the appropriate time. In general changes should be implemented in [[#SetProperties|SetProperties()]] since this will help to ensure that changes can be reversed if they are cancelled or when the game&#039;s &#039;&#039;UNDO&#039;&#039; command is invoked.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Save/Load==&lt;br /&gt;
Scripted objects do not have their state automatically saved and restored. It is the responsibility of the individual scripts to save and restored any necessary state across a Surveyor save session/load session, or across a Driver save game/load game. This is implemented using the PropertyObject [[#GetProperties|GetProperties()]] and [[#SetProperties|SetProperties()]] functions. When saving, Trainz will ensure that GetProperties() has been called for every PropertyObject that is being saved. The [[Soup]] returned by this function is stored along with any native state for the object in question. When reloading, Trainz will first create the object and load the native state, then will call the SetProperties() function with the saved Soup which instructs the script to restore its state.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==GetDescriptionHTML==&lt;br /&gt;
{{MethodHeader|public string GetDescriptionHTML(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
&#039;&#039;None&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Return Value;&lt;br /&gt;
HTML formatted string to be loaded into the Property Browser.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 public string GetDescriptionHTML(void)&lt;br /&gt;
 {&lt;br /&gt;
   StringTable strTable = GetAsset().GetStringTable();&lt;br /&gt;
   &lt;br /&gt;
   HTMLBuffer buffer = HTMLBufferStatic.Construct();&lt;br /&gt;
   buffer.Print(&amp;quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   buffer.Escape(strTable.GetString(&amp;quot;property_name_forename&amp;quot;));&lt;br /&gt;
   buffer.Print(&amp;quot;: &amp;lt;a href=live://property/forename&amp;gt;&amp;quot;);&lt;br /&gt;
   buffer.Escape(m_foreName);&lt;br /&gt;
   &amp;lt;nowiki&amp;gt;buffer.Print(&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
   buffer.Escape(strTable.GetString(&amp;quot;property_name_surname&amp;quot;));&lt;br /&gt;
   buffer.Print(&amp;quot;: &amp;lt;a href=live://property/forename&amp;gt;&amp;quot;);&lt;br /&gt;
   buffer.Escape(m_surName);&lt;br /&gt;
   &amp;lt;nowiki&amp;gt;buffer.Print(&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;);&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
   buffer.Print(&amp;quot;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   return buffer.AsString();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
This method is called by Trainz to retrieve HTML which a player can use to configure the objects properties. Any embedded properties should use the &#039;&#039;live://property/propertyID&#039;&#039; format, all player readable strings should be sourced from the asset string-table, and all player configurable values should be appropriately escaped to avoid HTML corruption.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The Trainz uses its Mini Browser to display the HTML. See the [[MiniBrowser]] page to find supported HTML elements.&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public Soup GetProperties(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
&#039;&#039;None&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Return Value&lt;br /&gt;
Soup object containing data appropriate to represent the configured state of the object.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 public Soup GetProperties(void)&lt;br /&gt;
 {&lt;br /&gt;
   Soup soup = inherited();&lt;br /&gt;
   soup.SetNamedTag(&amp;quot;forename&amp;quot;, m_foreName);&lt;br /&gt;
   soup.SetNamedTag(&amp;quot;surname&amp;quot;, m_surName);&lt;br /&gt;
   return soup;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
This method is used to save current properties into the session database. Care must be taken to ensure it writes data in the same tag format that [[#SetProperties|SetProperties()]] is expecting. When overriding this method to handle your own properties, always call through to the overridden parent by using inherited().&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public void SetProperties(Soup soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; = reference to &#039;&#039;soup&#039;&#039; to be saved to session.&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
None&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 public void SetProperties(Soup soup)&lt;br /&gt;
 {&lt;br /&gt;
   inherited(soup);&lt;br /&gt;
   m_foreName = soup.GetNamedTag(&amp;quot;forename&amp;quot;);&lt;br /&gt;
   m_surName = soup.GetNamedTag(&amp;quot;surname&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Restores object state with a Soup object returned from a previous call to GetProperties(). When overriding this method to handle your own properties, always call through to the overridden parent by using inherited(soup). This ensures that any data required by the parent class is appropriately set.&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==GetPropertyType==&lt;br /&gt;
{{MethodHeader|string GetPropertyType(string propertyID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
&lt;br /&gt;
;Return Value&lt;br /&gt;
The type of the current property.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 string GetPropertyType(string propertyID)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;forename&amp;quot; or propertyID == &amp;quot;surname&amp;quot;)&lt;br /&gt;
     return &amp;quot;string&amp;quot;;&lt;br /&gt;
   &lt;br /&gt;
   return inherited(propertyID);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
This method is used by Trainz to determine the type of the named property. The supported types and their parameters are listed in the table below.&lt;br /&gt;
{{TableHeader|width=50%|margin=15px}}&lt;br /&gt;
|Value type||Parameters||Description&lt;br /&gt;
|-&lt;br /&gt;
|string||minimum-length,maximum-length||A string value, with optional minimum and maximum lengths. e.g. &amp;quot;string,0,200&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|int||minimum-value,maximum-value,step-value||An integer value with optional minimum, maximum and &#039;step&#039; value. e.g. &amp;quot;int,0,100,5&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|float||minimum-value,maximum-value,step-value||An floating point value with optional minimum, maximum and &#039;step&#039; value. e.g. &amp;quot;float,0,10,0.5&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|list||sorted-bool||An list, with an optional sorting flag (default off). e.g. &amp;quot;list,1&amp;quot; to sort, &amp;quot;list,0&amp;quot; for unsorted.&lt;br /&gt;
|-&lt;br /&gt;
|map-object||category-list||A list of map objects in the route which match a specific non-optional category list. e.g. &amp;quot;map-object,IND&amp;quot; for an industry list.&lt;br /&gt;
|-&lt;br /&gt;
|asset-list||category-list||A list of locally installed, compatible and available assets which match a specific non-optional category list. e.g. &amp;quot;asset-list,DR&amp;quot; for a list of installed Driver Character assets.&lt;br /&gt;
|-&lt;br /&gt;
|link||||A link type. This would usually respond and set some specific value, or perhaps toggle a bool.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==GetPropertyName==&lt;br /&gt;
{{MethodHeader|string GetPropertyName(string propertyID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
&lt;br /&gt;
;Return Value&lt;br /&gt;
The name of the current property.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 string GetPropertyName(string propertyID)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;forename&amp;quot;)&lt;br /&gt;
     return GetAsset().GetStringTable().GetString(&amp;quot;property_name_forename&amp;quot;);&lt;br /&gt;
   if (propertyID == &amp;quot;surname&amp;quot;)&lt;br /&gt;
     return GetAsset().GetStringTable().GetString(&amp;quot;property_name_surname&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   return inherited(propertyID);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==GetPropertyDescription==&lt;br /&gt;
{{MethodHeader|string GetPropertyDescription(string propertyID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
&lt;br /&gt;
;Return Value&lt;br /&gt;
Description to be used as a caption for the edit box presented to the user for a specific property.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 string GetPropertyDescription(string propertyID)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;forename&amp;quot;)&lt;br /&gt;
     return GetAsset().GetStringTable().GetString(&amp;quot;property_description_forename&amp;quot;);&lt;br /&gt;
   if (propertyID == &amp;quot;surname&amp;quot;)&lt;br /&gt;
     return GetAsset().GetStringTable().GetString(&amp;quot;property_description_surname&amp;quot;);&lt;br /&gt;
   &lt;br /&gt;
   return inherited(propertyID);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==GetPropertyValue==&lt;br /&gt;
{{MethodHeader|public string GetPropertyValue(string propertyID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
A string representation of the value of the current property.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 public string GetPropertyValue(string propertyID)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;forename&amp;quot;)&lt;br /&gt;
     return m_foreName;&lt;br /&gt;
   if (propertyID == &amp;quot;surname&amp;quot;)&lt;br /&gt;
     return m_foreName;&lt;br /&gt;
   &lt;br /&gt;
   return inherited(propertyID);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Returns a string representation of the current value of the selected property, if possible. Where it is not possible to format a value into a string (such as with map-object and asset-list types) then any cached localised name may be returned, and native will attempt to find that object in any displayed list, etc.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==LinkPropertyValue==&lt;br /&gt;
{{MethodHeader|void LinkPropertyValue(string propertyID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
&#039;&#039;None&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 void LinkPropertyValue(string propertyID)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;doors&amp;quot;)&lt;br /&gt;
   {&lt;br /&gt;
     m_doorsOpen = !m_doorsOpen;&lt;br /&gt;
     SetMeshAnimationState(&amp;quot;doors&amp;quot;, m_doorsOpen);&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   inherited(propertyID);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Called when the player clicks on a &amp;quot;link&amp;quot; property type. Link properties are most frequently used to toggle boolean values and selecting &amp;quot;radio&amp;quot; buttons.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetPropertyElementList==&lt;br /&gt;
{{MethodHeader|public string[ ] GetPropertyElementList(string propertyID)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
A string array to for the player to select a value from.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 public string[] GetPropertyElementList(string propertyID)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;mode&amp;quot;)&lt;br /&gt;
   {&lt;br /&gt;
     StringTable strTable = GetAsset().GetStringTable();&lt;br /&gt;
     &lt;br /&gt;
     string[] result = new string[10];&lt;br /&gt;
     int i;&lt;br /&gt;
     for (i = 1; i &amp;lt; 10; ++i)&lt;br /&gt;
       result[i] = strTable.GetString(&amp;quot;property_list_mode_&amp;quot; + i);&lt;br /&gt;
     &lt;br /&gt;
     return result;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   return inherited(propertyID);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Retrieves a list possible values for a named property. Used for the &amp;quot;list&amp;quot; type. The returned list should support localisation by using string-table entries where appropriate.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FilterPropertyElementList==&lt;br /&gt;
{{MethodHeader|public bool FilterPropertyElementList(string propertyID, GSObject[] listObjects, string[] listNames)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
*&#039;&#039;&#039;listObjects&#039;&#039;&#039; = The list of objects about to be displayed.&lt;br /&gt;
*&#039;&#039;&#039;listNames&#039;&#039;&#039; = The names of the objects about to be displayed.&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
Whether the filter function has altered the list at all.&lt;br /&gt;
&lt;br /&gt;
;Example Implementation&lt;br /&gt;
 public bool FilterPropertyElementList(string propertyID, GSObject[] listObjects, string[] listNames)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;object-list&amp;quot;)&lt;br /&gt;
   {&lt;br /&gt;
     bool bDidChangeAnything = false;&lt;br /&gt;
     // Remove any already added objects from the list&lt;br /&gt;
     int i;&lt;br /&gt;
     for (i = 0; i &amp;lt; listObjects.size(); )&lt;br /&gt;
     {&lt;br /&gt;
       if (IsAlreadyInList(cast&amp;lt;GameObject&amp;gt;(listObjects[i])))&lt;br /&gt;
       {&lt;br /&gt;
         listObjects[i,i+1] = null;&lt;br /&gt;
         listNames[i,i+1] = null;&lt;br /&gt;
         bDidChangeAnything  = true;&lt;br /&gt;
       }&lt;br /&gt;
       else&lt;br /&gt;
       {&lt;br /&gt;
         ++i;&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     &lt;br /&gt;
     return bDidChangeAnything;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   return inherited(propertyID, listObjects, listNames);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Used for &amp;quot;map-object&amp;quot; and &amp;quot;asset-list&amp;quot; types to allow the list to be filtered before display. This gives the script an opportunity to cull any inappropriate values (such as those already added) and/or add any custom entries (such as a &amp;quot;none&amp;quot; selection).&lt;br /&gt;
&lt;br /&gt;
==SetPropertyValue==&lt;br /&gt;
{{MethodHeader|&lt;br /&gt;
void SetPropertyValue(string propertyID, string value)&amp;lt;br&amp;gt;&lt;br /&gt;
void SetPropertyValue(string propertyID, int value)&amp;lt;br&amp;gt;&lt;br /&gt;
void SetPropertyValue(string propertyID, float value)&amp;lt;br&amp;gt;&lt;br /&gt;
void SetPropertyValue(string propertyID, string value, int index)&amp;lt;br&amp;gt;&lt;br /&gt;
void SetPropertyValue(string propertyID, GSObject value, string readableName)&lt;br /&gt;
}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;propertyID&#039;&#039;&#039; = Name of property.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; = string, int, float or object value to assign to the property.&lt;br /&gt;
*&#039;&#039;&#039;index&#039;&#039;&#039; = list types only, specifies the index of the selected item in the list.&lt;br /&gt;
*&#039;&#039;&#039;readableName&#039;&#039;&#039; = map-object and asset-list types only, specifies the localised name of the object/asset selected.&lt;br /&gt;
&lt;br /&gt;
;Return Value&lt;br /&gt;
&#039;&#039;None&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Example Implementations&lt;br /&gt;
 void SetPropertyValue(string propertyID, string value)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;forename&amp;quot;)&lt;br /&gt;
   {&lt;br /&gt;
     m_foreName = value;&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   if (propertyID == &amp;quot;surname&amp;quot;)&lt;br /&gt;
   {&lt;br /&gt;
     m_surName = value;&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   inherited(propertyID, value);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void SetPropertyValue(string propertyID, GSObject value, string readableName)&lt;br /&gt;
 {&lt;br /&gt;
   if (propertyID == &amp;quot;junction&amp;quot;)&lt;br /&gt;
   {&lt;br /&gt;
     m_junctionID = cast&amp;lt;GameObjectID&amp;gt;(value);&lt;br /&gt;
     m_junctionName = readableName;&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   if (propertyID == &amp;quot;sound-asset&amp;quot;)&lt;br /&gt;
   {&lt;br /&gt;
     m_sound = cast&amp;lt;Asset&amp;gt;(value);&lt;br /&gt;
     m_soundName = readableName;&lt;br /&gt;
     return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   inherited(propertyID, value, readableName);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets a new value for the named property. The variant called depends on the property type, as returned by GetPropertyType().&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PropertyBrowserRefresh==&lt;br /&gt;
{{MethodHeader|public void PropertyBrowserRefresh(Browser browser)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;browser&#039;&#039;&#039; = Reference to &#039;&#039;browser&#039;&#039; object displaying properties.&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
&#039;&#039;None&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
A callback method which the script writer can override to specify tasks to be carried out whenever the Browser is refreshed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetPropertyHandler==&lt;br /&gt;
{{MethodHeader|public void SetPropertyHandler(HTMLPropertyHandler handler)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;handler&#039;&#039;&#039; = Handler to assign to this property object.&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
&#039;&#039;None&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Called to add a sub-handler property object to this object. The added HTMLPropertyHandler can then implement property lists, etc. This is useful for organising property values into groups. Several pre-defined HTMLPropertyHandler classes also already exist in the core Trainz scripts, which script programmers can use to save time and avoid code duplication.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetPropertyHandler==&lt;br /&gt;
{{MethodHeader|public HTMLPropertyHandler GetPropertyHandler(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
&#039;&#039;None&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
;Returned Value&lt;br /&gt;
A reference to the current property handler for this object, or null if none has been set.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_GameObject&amp;diff=29038</id>
		<title>Class GameObject</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_GameObject&amp;diff=29038"/>
		<updated>2021-03-27T12:33:37Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: Added link to list of known messages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**[[Class GSObject|GSObject]]&lt;br /&gt;
***GameObject&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*GameObject is the base class for any object that requires messaging and threading support. &lt;br /&gt;
*GameObjects are placed in the game&#039;s object table, known as the Router. &lt;br /&gt;
*You cannot create a GameObject using &#039;&#039;new()&#039;&#039; from a script, all game objects are created by the game. &lt;br /&gt;
*Each game object has a unique ID (see [[#GetId|GetId()]]) and many also have a name. &lt;br /&gt;
*GameObject instances are often referred to as a &#039;&#039;node&#039;&#039; because they represent a message node in the Router. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==AddHandler==&lt;br /&gt;
{{MethodHeader|public native void AddHandler(GameObject target, string major, string minor, string Handler)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Object to add the message handler to. This is usually &#039;&#039;me&#039;&#039; but can be any &#039;&#039;GameObject&#039;&#039;.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;major&#039;&#039;]] to listen for.&lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;minor&#039;&#039;]] to listen for. If this paremeter is null or an empty string then all messages that match the &#039;&#039;major&#039;&#039; parameter will be sent to the handler.&lt;br /&gt;
*&#039;&#039;&#039;Handler&#039;&#039;&#039; Name of the message handler method to call. This must have a prototype in of the form &#039;&#039;void MessageHandler(Message msg)&#039;&#039;&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 AddHandler(me,&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;,&amp;quot;ObjectHandler&amp;quot;);&lt;br /&gt;
 AddHandler(me,&amp;quot;Object&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ObjectHandler&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Adds a message handler to the current class such that it will be called whenever the target GameObject receives a matching message.&lt;br /&gt;
*Message handlers called by this means are not threaded and will be executed immediately.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ClearMessages==&lt;br /&gt;
{{MethodHeader|public native void ClearMessages(string major, string minor)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;major&#039;&#039;]] to listen for.&lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;minor&#039;&#039;]] to listen for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 ClearMessages(&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Clears any outstanding messages of the specified major and minor types that have been sent via calls to [[#PostMessage|PostMessage()]] and have not yet been processed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Exception==&lt;br /&gt;
{{MethodHeader|public native void Exception(string reason)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;reason&#039;&#039;&#039; = Explanatory text to add to the message box.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 Exception(&amp;quot;Fatal Error&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Raises an Exception on the current thread and prints out the contents of the &#039;&#039;reason&#039;&#039; parameter followed by a stack dump.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetId==&lt;br /&gt;
{{MethodHeader|public native int GetId(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The GameObject ID, an integer value which the Router uses to identify the current object.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int ID = GetId();&lt;br /&gt;
;Notes&lt;br /&gt;
*The ID is unique to the current session.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetName==&lt;br /&gt;
{{MethodHeader|public native string GetName(void)&#039;&#039;&#039;}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The name of the current object if it has one, an empty string otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string MyName = GetName();&lt;br /&gt;
;Notes&lt;br /&gt;
*The name returned is the text string that is shown at the top of the property object browser for the object concerned.&lt;br /&gt;
*If the name has been assigned by the game this will be the asset&#039;s username followed by a serial number.&lt;br /&gt;
*The string returned by this method is not guaranteed to be unique although TRS will issue prompts requesting confirmation in situations where duplication of names is about to occur.&lt;br /&gt;
*The name persists from session to session.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PostMessage==&lt;br /&gt;
{{MethodHeader|public native void PostMessage(GameObject dest, string major, string minor, float seconds)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;dest&#039;&#039;&#039; = Destination object for the message. If this is null the message will be broadcast.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;major&#039;&#039;]] to be sent. &lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;minor&#039;&#039;]] to be sent.&lt;br /&gt;
*&#039;&#039;&#039;seconds&#039;&#039;&#039; = Delay in seconds before the message is posted. If this is zero the message will be posted immediately.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 PostMessage(me,&amp;quot;Timer&amp;quot;,&amp;quot;Tick&amp;quot;,10.0); &lt;br /&gt;
 PostMessage(null,&amp;quot;Browser-URL&amp;quot;,&amp;quot;live://next&amp;quot;,0.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Messages sent via this method are processed by the Router in the next game update after they become due.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SendMessage==&lt;br /&gt;
{{MethodHeader|public native void SendMessage(GameObject dest, string major, string minor)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;dest&#039;&#039;&#039; = Destination object for the message. If this is null the message will be broadcast.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;major&#039;&#039;]] to be sent. &lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;minor&#039;&#039;]] to be sent.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SendMessage(train,&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Sends a message to the destination object for immediate processing.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sleep==&lt;br /&gt;
{{MethodHeader|public native void Sleep(float seconds)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;seconds&#039;&#039;&#039; = Time to wait in seconds.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 Sleep(10.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Causes the current thread to pause for the specified period of time.&lt;br /&gt;
*Warning! Sleep(World.PlaySound(...)) should no longer be used, as PlaySound does not return the file duration anymore!&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sniff==&lt;br /&gt;
{{MethodHeader|public native void Sniff(GameObject target, string major, string minor, bool state)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Game Object to which the handler will be attached.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;major&#039;&#039;]] to listen for.&lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;minor&#039;&#039;]] to listen for. If this parameter is null or an empty string then all messages matching the &#039;&#039;major&#039;&#039; parameter will be processed.&lt;br /&gt;
*&#039;&#039;&#039;state&#039;&#039;&#039; = Boolean flag to set whether or not the handler is currently active.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 Sniff(train,&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;,true);&lt;br /&gt;
;Notes&lt;br /&gt;
*Attaches a message handler to another object allowing the current script to listen in on the specified messages.&lt;br /&gt;
*Messages of the specified type received by the target object will be copied to the current script.&lt;br /&gt;
*The current script will usually need a separate handler to process these messages and will normally need to check the identity of the message source.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Examples==&lt;br /&gt;
Script calls made during the Init() method of an object can never be certain that other objects within the map have already been initialised. In cases where initialisation depends on the existence of other objects [[#PostMessage|PostMessage()]] can be used to delay part or all of the startup.  Messages sent in this way are never processed until the next game update and this does not occur until all objects have been initialised.&lt;br /&gt;
 public void Init(void)&lt;br /&gt;
 {&lt;br /&gt;
    inherited();&lt;br /&gt;
    SetupTasks();&lt;br /&gt;
    AddHandler(me,&amp;quot;Setup&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;SetupHandler&amp;quot;);&lt;br /&gt;
    PostMessage(me,&amp;quot;Setup&amp;quot;,&amp;quot;&amp;quot;,0.0);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void SetupHandler(Message msg)&lt;br /&gt;
 {&lt;br /&gt;
    if (msg.src == me)&lt;br /&gt;
    {&lt;br /&gt;
       MoreSetupTasks();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
[[Class Router#GetGameObject|Router.GetGameObject()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class Router#PostMessage|Router.PostMessage()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[TrainzScript Message Reference]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_GameObject&amp;diff=29037</id>
		<title>Class GameObject</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_GameObject&amp;diff=29037"/>
		<updated>2021-03-27T12:30:53Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* AddHandler */ Added link to list of known messages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[TrainzScript Library Reference|API Hierarchy]]&lt;br /&gt;
**[[Class GSObject|GSObject]]&lt;br /&gt;
***GameObject&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*GameObject is the base class for any object that requires messaging and threading support. &lt;br /&gt;
*GameObjects are placed in the game&#039;s object table, known as the Router. &lt;br /&gt;
*You cannot create a GameObject using &#039;&#039;new()&#039;&#039; from a script, all game objects are created by the game. &lt;br /&gt;
*Each game object has a unique ID (see [[#GetId|GetId()]]) and many also have a name. &lt;br /&gt;
*GameObject instances are often referred to as a &#039;&#039;node&#039;&#039; because they represent a message node in the Router. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==AddHandler==&lt;br /&gt;
{{MethodHeader|public native void AddHandler(GameObject target, string major, string minor, string Handler)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Object to add the message handler to. This is usually &#039;&#039;me&#039;&#039; but can be any &#039;&#039;GameObject&#039;&#039;.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;major&#039;&#039;]] to listen for.&lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = [[List of Standard Messages|Message &#039;&#039;minor&#039;&#039;]] to listen for. If this paremeter is null or an empty string then all messages that match the &#039;&#039;major&#039;&#039; parameter will be sent to the handler.&lt;br /&gt;
*&#039;&#039;&#039;Handler&#039;&#039;&#039; Name of the message handler method to call. This must have a prototype in of the form &#039;&#039;void MessageHandler(Message msg)&#039;&#039;&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 AddHandler(me,&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;,&amp;quot;ObjectHandler&amp;quot;);&lt;br /&gt;
 AddHandler(me,&amp;quot;Object&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ObjectHandler&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Adds a message handler to the current class such that it will be called whenever the target GameObject receives a matching message.&lt;br /&gt;
*Message handlers called by this means are not threaded and will be executed immediately.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==ClearMessages==&lt;br /&gt;
{{MethodHeader|public native void ClearMessages(string major, string minor)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = Message &#039;&#039;major&#039;&#039; to listen for.&lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = Message &#039;&#039;minor&#039;&#039; to listen for.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 ClearMessages(&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Clears any outstanding messages of the specified major and minor types that have been sent via calls to [[#PostMessage|PostMessage()]] and have not yet been processed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Exception==&lt;br /&gt;
{{MethodHeader|public native void Exception(string reason)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;reason&#039;&#039;&#039; = Explanatory text to add to the message box.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 Exception(&amp;quot;Fatal Error&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Raises an Exception on the current thread and prints out the contents of the &#039;&#039;reason&#039;&#039; parameter followed by a stack dump.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetId==&lt;br /&gt;
{{MethodHeader|public native int GetId(void)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The GameObject ID, an integer value which the Router uses to identify the current object.&lt;br /&gt;
;Syntax&lt;br /&gt;
 int ID = GetId();&lt;br /&gt;
;Notes&lt;br /&gt;
*The ID is unique to the current session.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetName==&lt;br /&gt;
{{MethodHeader|public native string GetName(void)&#039;&#039;&#039;}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*None&lt;br /&gt;
;Returned Value&lt;br /&gt;
*The name of the current object if it has one, an empty string otherwise.&lt;br /&gt;
;Syntax&lt;br /&gt;
 string MyName = GetName();&lt;br /&gt;
;Notes&lt;br /&gt;
*The name returned is the text string that is shown at the top of the property object browser for the object concerned.&lt;br /&gt;
*If the name has been assigned by the game this will be the asset&#039;s username followed by a serial number.&lt;br /&gt;
*The string returned by this method is not guaranteed to be unique although TRS will issue prompts requesting confirmation in situations where duplication of names is about to occur.&lt;br /&gt;
*The name persists from session to session.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PostMessage==&lt;br /&gt;
{{MethodHeader|public native void PostMessage(GameObject dest, string major, string minor, float seconds)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;dest&#039;&#039;&#039; = Destination object for the message. If this is null the message will be broadcast.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = Message &#039;&#039;major&#039;&#039; to be sent. &lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = Message &#039;&#039;minor&#039;&#039; to be sent.&lt;br /&gt;
*&#039;&#039;&#039;seconds&#039;&#039;&#039; = Delay in seconds before the message is posted. If this is zero the message will be posted immediately.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 PostMessage(me,&amp;quot;Timer&amp;quot;,&amp;quot;Tick&amp;quot;,10.0); &lt;br /&gt;
 PostMessage(null,&amp;quot;Browser-URL&amp;quot;,&amp;quot;live://next&amp;quot;,0.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Messages sent via this method are processed by the Router in the next game update after they become due.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SendMessage==&lt;br /&gt;
{{MethodHeader|public native void SendMessage(GameObject dest, string major, string minor)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;dest&#039;&#039;&#039; = Destination object for the message. If this is null the message will be broadcast.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = Message &#039;&#039;major&#039;&#039; to be sent. &lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = Message &#039;&#039;minor&#039;&#039; to be sent.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 SendMessage(train,&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;);&lt;br /&gt;
;Notes&lt;br /&gt;
*Sends a message to the destination object for immediate processing.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sleep==&lt;br /&gt;
{{MethodHeader|public native void Sleep(float seconds)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;seconds&#039;&#039;&#039; = Time to wait in seconds.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 Sleep(10.0);&lt;br /&gt;
;Notes&lt;br /&gt;
*Causes the current thread to pause for the specified period of time.&lt;br /&gt;
*Warning! Sleep(World.PlaySound(...)) should no longer be used, as PlaySound does not return the file duration anymore!&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Sniff==&lt;br /&gt;
{{MethodHeader|public native void Sniff(GameObject target, string major, string minor, bool state)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;target&#039;&#039;&#039; = Game Object to which the handler will be attached.&lt;br /&gt;
*&#039;&#039;&#039;major&#039;&#039;&#039; = Message &#039;&#039;major&#039;&#039; to listen for.&lt;br /&gt;
*&#039;&#039;&#039;minor&#039;&#039;&#039; = Message &#039;&#039;minor&#039;&#039; to listen for. If this parameter is null or an empty string then all messages matching the &#039;&#039;major&#039;&#039; parameter will be processed.&lt;br /&gt;
*&#039;&#039;&#039;state&#039;&#039;&#039; = Boolean flag to set whether or not the handler is currently active.&lt;br /&gt;
;Returned Value&lt;br /&gt;
*None&lt;br /&gt;
;Syntax&lt;br /&gt;
 Sniff(train,&amp;quot;Object&amp;quot;,&amp;quot;Enter&amp;quot;,true);&lt;br /&gt;
;Notes&lt;br /&gt;
*Attaches a message handler to another object allowing the current script to listen in on the specified messages.&lt;br /&gt;
*Messages of the specified type received by the target object will be copied to the current script.&lt;br /&gt;
*The current script will usually need a separate handler to process these messages and will normally need to check the identity of the message source.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Code Examples==&lt;br /&gt;
Script calls made during the Init() method of an object can never be certain that other objects within the map have already been initialised. In cases where initialisation depends on the existence of other objects [[#PostMessage|PostMessage()]] can be used to delay part or all of the startup.  Messages sent in this way are never processed until the next game update and this does not occur until all objects have been initialised.&lt;br /&gt;
 public void Init(void)&lt;br /&gt;
 {&lt;br /&gt;
    inherited();&lt;br /&gt;
    SetupTasks();&lt;br /&gt;
    AddHandler(me,&amp;quot;Setup&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;SetupHandler&amp;quot;);&lt;br /&gt;
    PostMessage(me,&amp;quot;Setup&amp;quot;,&amp;quot;&amp;quot;,0.0);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void SetupHandler(Message msg)&lt;br /&gt;
 {&lt;br /&gt;
    if (msg.src == me)&lt;br /&gt;
    {&lt;br /&gt;
       MoreSetupTasks();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related Methods==&lt;br /&gt;
[[Class Router#GetGameObject|Router.GetGameObject()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Class Router#PostMessage|Router.PostMessage()]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[TrainzScript Message Reference]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Categories==&lt;br /&gt;
[[Category:Script Class]]&lt;/div&gt;</summary>
		<author><name>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29036</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29036"/>
		<updated>2021-03-27T12:20:59Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* SetStateFlags */ Flags not specified by the parameter keep their old value.&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&amp;lt;br&amp;gt;&lt;br /&gt;
The state of the ScenarioBehavior instance can be any combination of these flags, e.g. PAUSED | WAS_COMPLETE | DOES_COMPLETE means the rule is currently not running (is paused), was completed in the past at least once, and can reach a COMPLETE state (i.e. is not a continuous rule running infinitely).&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=300|public define int &#039;&#039;&#039;NONE&#039;&#039;&#039; = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;PAUSED&#039;&#039;&#039; = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;COMPLETE&#039;&#039;&#039; = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;WAS_COMPLETE&#039;&#039;&#039; = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;DOES_COMPLETE&#039;&#039;&#039; = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&amp;lt;br&amp;gt;(Distinguishes rules that can complete their execution from infinitely continuous rules.)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial state of the ScenarioBehavior is PAUSED.&amp;lt;br&amp;gt;&lt;br /&gt;
The inheriting class needs to set the DOES_COMPLETE flag by itself if it wants to mark itself as not continuous rule.&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must override this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
The method changes value only of the flags specified in the &#039;flags&#039; parameter. All other flags will keep their old value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties|GetProperties()]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overridden, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString|GetSessionString()]] function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString|SetSessionString()]] function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured|IsCorrectlyConfigured()]]).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29035</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29035"/>
		<updated>2021-03-27T12:17:19Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* Constants */ Added information about the default state.&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&amp;lt;br&amp;gt;&lt;br /&gt;
The state of the ScenarioBehavior instance can be any combination of these flags, e.g. PAUSED | WAS_COMPLETE | DOES_COMPLETE means the rule is currently not running (is paused), was completed in the past at least once, and can reach a COMPLETE state (i.e. is not a continuous rule running infinitely).&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=300|public define int &#039;&#039;&#039;NONE&#039;&#039;&#039; = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;PAUSED&#039;&#039;&#039; = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;COMPLETE&#039;&#039;&#039; = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;WAS_COMPLETE&#039;&#039;&#039; = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int &#039;&#039;&#039;DOES_COMPLETE&#039;&#039;&#039; = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&amp;lt;br&amp;gt;(Distinguishes rules that can complete their execution from infinitely continuous rules.)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The initial state of the ScenarioBehavior is PAUSED.&amp;lt;br&amp;gt;&lt;br /&gt;
The inheriting class needs to set the DOES_COMPLETE flag by itself if it wants to mark itself as not continuous rule.&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must override this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties|GetProperties()]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overridden, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString|GetSessionString()]] function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString|SetSessionString()]] function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured|IsCorrectlyConfigured()]]).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29032</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29032"/>
		<updated>2021-03-26T22:23:08Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: Changed overwrite -&amp;gt; override&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must override this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties|GetProperties()]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overridden, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString|GetSessionString()]] function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString|SetSessionString()]] function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured|IsCorrectlyConfigured()]]).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29031</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29031"/>
		<updated>2021-03-26T21:14:14Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* GetSessionString */ Corrected display of link to SetSessionString()&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must overwrite this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties|GetProperties()]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overwritten, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString|GetSessionString()]] function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString|SetSessionString()]] function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured|IsCorrectlyConfigured()]]).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29030</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29030"/>
		<updated>2021-03-26T21:12:56Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* SetSessionString */ Corrected display of link to GetSessionString()&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must overwrite this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties|GetProperties()]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overwritten, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString|GetSessionString()]] function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString]]() function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured|IsCorrectlyConfigured()]]).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29029</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29029"/>
		<updated>2021-03-26T21:11:51Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* SetChildrenLimits */ Corrected display of link to IsCorrectlyConfigured()&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must overwrite this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties|GetProperties()]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overwritten, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString]]() function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString]]() function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured|IsCorrectlyConfigured()]]).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29028</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29028"/>
		<updated>2021-03-26T21:10:28Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* SetProperties */ Corrected display of link to GetProperties()&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must overwrite this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties|GetProperties()]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overwritten, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString]]() function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString]]() function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured]]()).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29027</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29027"/>
		<updated>2021-03-26T21:09:19Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* Constants */ Adjustments to the display of GetStateFlags() and SetStateFlags()&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags|GetStateFlags()]] and [[#SetStateFlags|SetStateFlags()]] methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must overwrite this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overwritten, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString]]() function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString]]() function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured]]()).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29026</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29026"/>
		<updated>2021-03-26T21:07:38Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* Constants */ Fixed links to GetStateFlags and SetStateFlags&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[#GetStateFlags]]() and [[#SetStateFlags]]() methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must overwrite this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overwritten, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString]]() function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString]]() function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured]]()).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29025</id>
		<title>Class ScenarioBehavior</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_ScenarioBehavior&amp;diff=29025"/>
		<updated>2021-03-26T21:06:17Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: Page created&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;
***** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
** [[Class PropertyObject|PropertyObject]]&lt;br /&gt;
*** ScenarioBehavior (scenariobehavior.gs)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ScenarioBehavior class is the base class for session rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Constants==&lt;br /&gt;
*These constants represent flags defining the rule&#039;s state. They can be used in combination with [[GetStateFlags]]() and [[SetStateFlags]]() methods.&lt;br /&gt;
&lt;br /&gt;
{{TableHeader|width=95%|margin=15px}}&lt;br /&gt;
|width=375|public define int NONE = 0||No flags set.&lt;br /&gt;
|-&lt;br /&gt;
|public define int PAUSED = 1||This behavior is currently paused.&lt;br /&gt;
|-&lt;br /&gt;
|public define int COMPLETE = 2||This behavior is complete.&lt;br /&gt;
|-&lt;br /&gt;
|public define int WAS_COMPLETE = 4||This behavior was complete some time previously.&lt;br /&gt;
|-&lt;br /&gt;
|public define int DOES_COMPLETE = 8||This behavior is capable of reaching a &amp;lt;COMPLETE&amp;gt; state.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pause==&lt;br /&gt;
{{MethodHeader|public void Pause(bool pause)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;pause&#039;&#039;&#039; = Whether the rule is being paused (true) or unpaused (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Pauses or un-pauses this behavior. This is called either by Trainz native code or the behavior&#039;s parent. When called this rule should begin or stop whatever it is configured to do.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method in ScenarioBehavior does nothing by itself. The rule inheriting from the ScenarioBehavior must overwrite this method and set/clear the [[#Constants|PAUSED]] flag by itself. When called with &#039;false&#039; parameter, the rule should start executing its own logic.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetComplete==&lt;br /&gt;
{{MethodHeader|public void SetComplete(bool isComplete)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;isComplete&#039;&#039;&#039; = Whether the rule is complete (true) or not (false).&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Sets this rule as complete. This should be called on any rule that can reach a state where it is no longer doing anything, once it reaches that state. If this rule executes children, then this should not be called until all children have completed.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
This method sets/clears the [[#Constants|COMPLETE]] flag. If called with &#039;true&#039; parameter it sets also the [[#Constants|WAS_COMPLETE]] flag.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsComplete==&lt;br /&gt;
{{MethodHeader|public bool IsComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is currently complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==WasComplete==&lt;br /&gt;
{{MethodHeader|public bool WasComplete(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior was ever complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsPaused==&lt;br /&gt;
{{MethodHeader|public bool IsPaused(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Returns whether this behavior is paused.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetStateFlags==&lt;br /&gt;
{{MethodHeader|public int GetStateFlags(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Current state flags for this behavior object.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetStateFlags==&lt;br /&gt;
{{MethodHeader|public void SetStateFlags(int flags, bool set)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;flags&#039;&#039;&#039; = state flags that should be set/cleared&lt;br /&gt;
*&#039;&#039;&#039;set&#039;&#039;&#039; = whether the flags should be set (true) or cleared (false)&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
Sets the state of the specified flags for this behavior.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory [[Class Soup|Soup]] GetProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Soup database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Inheriting classes should override this to save all rule state. This includes the Surveyor configuration, and Driver runtime state, as this function is used for saving sessions/profiles, and for savegames.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetProperties==&lt;br /&gt;
{{MethodHeader|public mandatory void SetProperties([[Class Soup|Soup]] soup)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;soup&#039;&#039;&#039; - [[Class Soup|Soup]] database describing the current state of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Configures this rule state using a Soup database created by a previous call to [[#GetProperties]]. This call should restore all data, start any necessary threads, add handlers, etc. such that the rule can continue execution in whatever state it was previously.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetRequirements==&lt;br /&gt;
{{MethodHeader|public [[Class Requirement|Requirement]][] GetRequirements(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Resource requirements of this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* This is called by Trainz native code to determine the product requirements of a behavior (if any) so a waybill listing drop-off/pickup requirements can be displayed to the user.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildBehaviors==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior[] GetChildBehaviors(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
*Child behaviors under this one, i.e. the ones immediately below this one in the Surveyor Rules Editor&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AreAllChildrenComplete==&lt;br /&gt;
{{MethodHeader|public bool AreAllChildrenComplete()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* Whether all child rules are complete&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetParentBehavior==&lt;br /&gt;
{{MethodHeader|public native ScenarioBehavior GetParentBehavior(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The parent of this rule in the rules list (i.e., the rule that will/should execute it).&lt;br /&gt;
* null for &amp;quot;top level&amp;quot; rules.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reset==&lt;br /&gt;
{{MethodHeader|public void Reset(void)}}&lt;br /&gt;
;Description&lt;br /&gt;
*Resets the [[#Constants|COMPLETE]] and [[#Constants|WAS_COMPLETE]] flags for this rule.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetDescription==&lt;br /&gt;
{{MethodHeader|public string GetDescription(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* The text describing this rule.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets a short text description of this session rule, for display in the rules list. This should at least contain a basic overview of what the rule does, but may also reference specific configured objects etc. Basic html markup is supported but do not include images, embedded objects, etc.&lt;br /&gt;
&lt;br /&gt;
;Note&lt;br /&gt;
* If not overwritten, then the method returns string with key &amp;quot;description&amp;quot; from the [[Class StringTable|string table]].&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AppendDependencies==&lt;br /&gt;
{{MethodHeader|public void AppendDependencies([[Class KUIDList|KUIDList]] io_dependencies)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;io_dependencies&#039;&#039;&#039; - ???&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Gets any asset dependencies that are specific to this rule instance. This method is called by Trainz to determine the asset dependencies of this rule instance, as configured by the player in Surveyor. Inheriting scripts should override this to add assets that the player may configure/select, e.g. html assets, sounds, textures.&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;
;Return value&lt;br /&gt;
* The human-readable string identifying this ScenarioBehavior.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*Returns a human-readable string identifying this ScenarioBehavior. Used for debugging purposes. The exact contents of this string may vary based on the class of this object and the Trainz version. Do not attempt to machine-parse this value.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetSessionString==&lt;br /&gt;
{{MethodHeader|native void SetSessionString(string tag, string value)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - A unique identifier by which to refer to this string.&lt;br /&gt;
*&#039;&#039;&#039;value&#039;&#039;&#039; - The English value for this string.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
*SURVEYOR ONLY - Creates a localisable string-table entry in the current session asset with the tag and English value passed. This should be used in any situation where a session creator is required to enter player visible text. The KUID for this ScenarioBehaviour will be prepended to the tag when the config.txt is updated. Use the [[#GetSessionString]]() function to retrieve the string for display&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionString==&lt;br /&gt;
{{MethodHeader|native string GetSessionString(string tag)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;tag&#039;&#039;&#039; - The unique identifier by which to refer to this string&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
* Session string-table entry created by this asset using the [[#SetSessionString]]() function.&lt;br /&gt;
** If present the string for the currently active local will be returned.&lt;br /&gt;
** English value will be returned if localised is not present.&lt;br /&gt;
** Empty string will be returned if no string with the specified tag exists for this asset.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==IsCorrectlyConfigured==&lt;br /&gt;
{{MethodHeader|public bool IsCorrectlyConfigured()}}&lt;br /&gt;
;Return value&lt;br /&gt;
* true if this rule is correctly configured&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to test whether this rule has been correctly configured by the player. If it returns false Surveyor will show a visual indication to the player that the setup needs action.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SetChildrenLimits==&lt;br /&gt;
{{MethodHeader|public void SetChildrenLimits(int minChildren, int maxChildren)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;minChildren&#039;&#039;&#039; - The minimum number of children required&lt;br /&gt;
*&#039;&#039;&#039;maxChildren&#039;&#039;&#039; - The maximum number of children allowed, or -1 for no max&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Sets the limits on the number of children this rule can have. Rules configured in Surveyor with more than the max or less that the minimum will display as incorrectly configured (via [[#IsCorrectlyConfigured]]()).&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetChildRelationshipIcon==&lt;br /&gt;
{{MethodHeader|public string GetChildRelationshipIcon(ScenarioBehavior child)}}&lt;br /&gt;
;Parameters&lt;br /&gt;
*&#039;&#039;&#039;child&#039;&#039;&#039; - The child of this rule to get the relationship for&lt;br /&gt;
&lt;br /&gt;
;Return value&lt;br /&gt;
*Either:&lt;br /&gt;
** &amp;quot;none&amp;quot; - The child is not used by this rule in any way&lt;br /&gt;
** &amp;quot;simultaneous&amp;quot; - Rule is a child, and all children are executed simultaneously on completion&lt;br /&gt;
** A positive integer, representing the order in which a child rule will be executed by the parent on completion (e.g., &amp;quot;1&amp;quot; is first, &amp;quot;2&amp;quot; is second, etc.)&lt;br /&gt;
** A path to a custom icon file within this rule assets dir&lt;br /&gt;
** A KUID for a custom texture asset&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Called by native code in Surveyor to get an icon to indicate the relationship of a child rule to its parent (this rule). This is for Surveyor display purposes only and provides no rule functionality.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==GetSessionProperties==&lt;br /&gt;
{{MethodHeader|public [[Class Soup|Soup]] GetSessionProperties(void)}}&lt;br /&gt;
;Return value&lt;br /&gt;
* [[Class Soup|Soup]] form of rule-data container to be written.&lt;br /&gt;
&lt;br /&gt;
;Description&lt;br /&gt;
* Retrieve any data this rule wishes to store in the config.txt of the session, to be made available to script outside of the session (i.e. when it is not running), such as in a menu etc.&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>Marekp9</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=29023</id>
		<title>Class World</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Class_World&amp;diff=29023"/>
		<updated>2021-03-26T18:46:05Z</updated>

		<summary type="html">&lt;p&gt;Marekp9: /* SetGameDate */ Corrected Time to Date&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 SetGameDate(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.SetGameDate(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>Marekp9</name></author>
	</entry>
</feed>