<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.trainzsimulator.com/index.php?action=history&amp;feed=atom&amp;title=Automating_Animations.</id>
	<title>Automating Animations. - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.trainzsimulator.com/index.php?action=history&amp;feed=atom&amp;title=Automating_Animations."/>
	<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;action=history"/>
	<updated>2026-11-05T08:10:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=11449&amp;oldid=prev</id>
		<title>Tonyhilliam at 02:07, 17 January 2018</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=11449&amp;oldid=prev"/>
		<updated>2018-01-17T02:07:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:07, 17 January 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l70&quot;&gt;Line 70:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 70:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If its not quite right you may need to go back to the Max source and adjust some of the dimensions.  The Object messages which control the doors are issued when the centre point of the traincar crosses the trigger radius.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If its not quite right you may need to go back to the Max source and adjust some of the dimensions.  The Object messages which control the doors are issued when the centre point of the traincar crosses the trigger radius.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next Tutorial: [[Handling Corona Effects.]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next Tutorial: [[Handling Corona Effects.]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Getting_Started_in_TrainzScript|Back to Getting Started]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Tonyhilliam</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=1412&amp;oldid=prev</id>
		<title>Windwalkr (legacy 2550) at 09:34, 25 March 2010</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=1412&amp;oldid=prev"/>
		<updated>2010-03-25T09:34:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:34, 25 March 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l68&quot;&gt;Line 68:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The selected train should head off towards the engine shed. Once it gets close enough the doors should open and the train should slow down as it approaches the end of the track. Once inside the train should stop and the doors should close. Since the shed doesn&amp;#039;t currently have a visible roof you will be able to see all of this happening.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The selected train should head off towards the engine shed. Once it gets close enough the doors should open and the train should slow down as it approaches the end of the track. Once inside the train should stop and the doors should close. Since the shed doesn&amp;#039;t currently have a visible roof you will be able to see all of this happening.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If its not quite right you may need to go back to the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;gmax &lt;/del&gt;source and adjust some of the dimensions.  The Object messages which control the doors are issued when the centre point of the traincar crosses the trigger radius.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If its not quite right you may need to go back to the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Max &lt;/ins&gt;source and adjust some of the dimensions.  The Object messages which control the doors are issued when the centre point of the traincar crosses the trigger radius.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next Tutorial: [[Handling Corona Effects.]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Next Tutorial: [[Handling Corona Effects.]]&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Windwalkr (legacy 2550)</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=160&amp;oldid=prev</id>
		<title>Windwalkr: 1 revision</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=160&amp;oldid=prev"/>
		<updated>2010-02-03T13:58:24Z</updated>

		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:58, 3 February 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Windwalkr</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=159&amp;oldid=prev</id>
		<title>Andi06: /* Automating Animations */</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Automating_Animations.&amp;diff=159&amp;oldid=prev"/>
		<updated>2008-07-11T22:55:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Automating Animations&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The code to deal with this follows. Any text sandwiched between /* and */ character pairs, and the text on any line starting with //, will be treated as a comment and ignored by the compiler.&lt;br /&gt;
&lt;br /&gt;
 include &amp;quot;Buildable.gs&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Tutorial isclass Buildable {&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=#808080&amp;gt;/* We will need a variable to keep track of whether the shed doors are open or closed,&lt;br /&gt;
    declaring this in the body of the class and outside of any method definitions will&lt;br /&gt;
    make it available to any method in the class.*/ &amp;lt;/font&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    bool doorsOpen = false;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=#808080&amp;gt;/* We are going to open and close the doors whenever a vehicle enters or leaves the area &lt;br /&gt;
    defined by our trigger.  To do this we will be listening for &amp;#039;&amp;#039;Object,InnerEnter&amp;#039;&amp;#039; and&lt;br /&gt;
    &amp;#039;&amp;#039;Object,InnerLeave&amp;#039;&amp;#039; messages. We do this by adding a handler in Init().*/ &amp;lt;/font&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    public void Init(void) {&lt;br /&gt;
       inherited();&lt;br /&gt;
       SetFXCoronaTexture(&amp;quot;corona&amp;quot;,null);&lt;br /&gt;
       AddHandler(me,&amp;quot;Object&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;ObjectHandler&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;font color=#808080&amp;gt;/* Object handler will &amp;#039;wake up&amp;#039; whenever we receive an Object message. It is good &lt;br /&gt;
    practice to check that the message is coming from an expected source. This is done &lt;br /&gt;
    by converting or &amp;#039;casting&amp;#039; the source of the message to a vehicle.  If the cast does&lt;br /&gt;
    not work the variable &amp;#039;&amp;#039;vehicle&amp;#039;&amp;#039; will be null and the handler is exited immediately. &lt;br /&gt;
    The remainder of the method checks whether the vehicle is entering or leaving and runs &lt;br /&gt;
    the animations as appropriate. &amp;#039;&amp;#039;SetMeshAnimationState()&amp;#039;&amp;#039; runs the animation attached &lt;br /&gt;
    to the named mesh from its current position to the beginning or end, depending on the &lt;br /&gt;
    value of the second parameter.*/ &amp;lt;/font&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    void ObjectHandler(Message msg) {&lt;br /&gt;
       Vehicle vehicle = cast&amp;lt;Vehicle&amp;gt;msg.src;&lt;br /&gt;
       if (!vehicle) return;&lt;br /&gt;
       if (msg.minor == &amp;quot;InnerEnter&amp;quot;) {&lt;br /&gt;
          doorsOpen = true;&lt;br /&gt;
          SetMeshAnimationState(&amp;quot;default&amp;quot;, true);&lt;br /&gt;
       }&lt;br /&gt;
       else if (msg.minor == &amp;quot;InnerLeave&amp;quot;) {&lt;br /&gt;
          doorsOpen = false;&lt;br /&gt;
          SetMeshAnimationState(&amp;quot;default&amp;quot;, false);&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
There are a couple of quirks to notice about the code in &amp;#039;&amp;#039;ObjectHandler&amp;#039;&amp;#039;:&lt;br /&gt;
&lt;br /&gt;
1. The cast statement &amp;#039;&amp;#039;&amp;#039;Vehicle vehicle = cast&amp;lt;Vehicle&amp;gt;msg.src;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* If you have remembered that TrainzScript is case sensitive you will see that there is a difference between        &amp;#039;&amp;#039;Vehicle&amp;#039;&amp;#039; and &amp;#039;&amp;#039;vehicle&amp;#039;&amp;#039;.&lt;br /&gt;
* The former is a built-in class name and the latter is a variable, so the phrase &amp;#039;&amp;#039;Vehicle vehicle&amp;#039;&amp;#039; is a declaration of a variable called &amp;#039;&amp;#039;vehicle&amp;#039;&amp;#039; to be of the class &amp;#039;&amp;#039;Vehicle&amp;#039;&amp;#039;. You may need to read that a couple of times.&lt;br /&gt;
* I don&amp;#039;t personally like this convention (script is confusing enough without it) but you will see it frequently so you might as well start getting used to it now.&lt;br /&gt;
&lt;br /&gt;
2. The &amp;#039;&amp;#039;if&amp;#039;&amp;#039; statement &amp;#039;&amp;#039;&amp;#039;if (msg.minor == &amp;quot;InnerEnter&amp;quot;) doorsOpen = true;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;==&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;=&amp;#039;&amp;#039;&amp;#039; mean different things.&lt;br /&gt;
* &amp;#039;&amp;#039;doorsOpen = true&amp;#039;&amp;#039; is an assignment, the same as saying let &amp;#039;&amp;#039;doorsOpen&amp;#039;&amp;#039; be equal to &amp;#039;&amp;#039;true&amp;#039;&amp;#039;.&lt;br /&gt;
* &amp;#039;&amp;#039;msg.minor == &amp;quot;InnerEnter&amp;quot;&amp;#039;&amp;#039; is a comparison which will return &amp;#039;&amp;#039;true&amp;#039;&amp;#039; if &amp;#039;&amp;#039;msg.minor&amp;#039;&amp;#039; is equal to &amp;#039;&amp;#039;&amp;quot;InnerEnter&amp;quot;&amp;#039;&amp;#039; and false otherwise.&lt;br /&gt;
* The most common mistake you will make is to type &amp;#039;&amp;#039;if (msg.minor = &amp;quot;InnerEnter&amp;quot;)&amp;#039;&amp;#039;, missing out the second equals sign. This will always evaluate to true, will usually mess up your code, and will always be difficult to spot. You have been warned.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check out your script:&lt;br /&gt;
* Compile the code and reload and commit the asset.&lt;br /&gt;
* Start Surveyor and place an instance (a copy) of the object on your map. &lt;br /&gt;
* Add a section of track to the track node nearest to the doors and extend it some distance away from the object&lt;br /&gt;
* Place a railcar or something similar at the far end of the track, orient it towards the engine shed.&lt;br /&gt;
* Go to Driver via the Quick Launch button, select DCC mode and click on the train that you have just placed.&lt;br /&gt;
* Issue a &amp;#039;&amp;#039;Drive&amp;#039;&amp;#039; command.&lt;br /&gt;
The selected train should head off towards the engine shed. Once it gets close enough the doors should open and the train should slow down as it approaches the end of the track. Once inside the train should stop and the doors should close. Since the shed doesn&amp;#039;t currently have a visible roof you will be able to see all of this happening.&lt;br /&gt;
&lt;br /&gt;
If its not quite right you may need to go back to the gmax source and adjust some of the dimensions.  The Object messages which control the doors are issued when the centre point of the traincar crosses the trigger radius.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Next Tutorial: [[Handling Corona Effects.]]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Andi06</name></author>
	</entry>
</feed>