<?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=Permit</id>
	<title>Permit - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.trainzsimulator.com/index.php?action=history&amp;feed=atom&amp;title=Permit"/>
	<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Permit&amp;action=history"/>
	<updated>2026-11-05T09:40:26Z</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=Permit&amp;diff=26772&amp;oldid=prev</id>
		<title>Christopher824: corrected minor formatting of text</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Permit&amp;diff=26772&amp;oldid=prev"/>
		<updated>2021-01-08T11:07:44Z</updated>

		<summary type="html">&lt;p&gt;corrected minor formatting of text&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 11:07, 8 January 2021&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-l20&quot;&gt;Line 20:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 20:&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;&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;  - Regularly checking IsGranted() which will return true after the Permit is Granted.&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;  - Regularly checking IsGranted() which will return true after the Permit is Granted.&lt;/div&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;     &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;bi &lt;/del&gt;DO NOT&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;gt; &lt;/del&gt;use IsGranted() continuously to wait because it just wastes CPU time, but there&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;     &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&lt;/ins&gt;DO NOT&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &lt;/ins&gt;use IsGranted() continuously to wait because it just wastes CPU time, but there&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;     may be other uses for this method, such as if we want to request a permit now for use in the&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;     may be other uses for this method, such as if we want to request a permit now for use in the&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;     future, and don&amp;#039;t want to have to listen to the (&amp;lt;m&amp;quot;Permit&amp;quot;&amp;gt;, &amp;lt;m &amp;quot;Granted&amp;quot;&amp;gt;) message all the&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;     future, and don&amp;#039;t want to have to listen to the (&amp;lt;m&amp;quot;Permit&amp;quot;&amp;gt;, &amp;lt;m &amp;quot;Granted&amp;quot;&amp;gt;) message all the&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Christopher824</name></author>
	</entry>
	<entry>
		<id>https://wiki.trainzsimulator.com/index.php?title=Permit&amp;diff=26737&amp;oldid=prev</id>
		<title>Christopher824: First entry to page</title>
		<link rel="alternate" type="text/html" href="https://wiki.trainzsimulator.com/index.php?title=Permit&amp;diff=26737&amp;oldid=prev"/>
		<updated>2021-01-07T11:58:04Z</updated>

		<summary type="html">&lt;p&gt;First entry to page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Permit provides a way of requesting control of a game object resource such as a Track or Junction.&lt;br /&gt;
&lt;br /&gt;
Permits are acquired by requesting them from various game objects.  Some objects may only give&lt;br /&gt;
out one permit at a time, others may give multiple permits with certain conditions.  For example,&lt;br /&gt;
a track could permit several trains travelling in the same direction.&lt;br /&gt;
&lt;br /&gt;
Permits are used to stop scripts from &amp;#039;fighting&amp;#039; over resources in situations such as:&lt;br /&gt;
 - Two trains want to go opposite directions down a single line; or&lt;br /&gt;
 - Two trains want to go through the same junction.&lt;br /&gt;
&lt;br /&gt;
When a request is made, a permit is always returned, however it is not automatically granted.&lt;br /&gt;
Instead, you have to wait for the permit to reach a &amp;#039;granted&amp;#039; state. You can determine when a&lt;br /&gt;
permit has been granted by:&lt;br /&gt;
&lt;br /&gt;
 - Performing a &amp;lt;l gscLangKeyWait wait()&amp;gt; on a message of type (&amp;lt;m&amp;quot;Permit&amp;quot;&amp;gt;, &amp;lt;m &amp;quot;Granted&amp;quot;&amp;gt;).&lt;br /&gt;
    Just make sure you check that it is &amp;lt;bi YOUR&amp;gt; permit that was granted. You can do this by&lt;br /&gt;
    just calling WasGranted() on your permit after receiving the message. The message is sent&lt;br /&gt;
    to the GameObject passed in to the &amp;amp;lt;b RequestPermit&amp;amp;gt; methods such as&lt;br /&gt;
    Junction::RequestPermit() or Track::RequestPermitForTrain().&lt;br /&gt;
&lt;br /&gt;
 - Regularly checking IsGranted() which will return true after the Permit is Granted.&lt;br /&gt;
    &amp;lt;bi DO NOT&amp;gt; use IsGranted() continuously to wait because it just wastes CPU time, but there&lt;br /&gt;
    may be other uses for this method, such as if we want to request a permit now for use in the&lt;br /&gt;
    future, and don&amp;#039;t want to have to listen to the (&amp;lt;m&amp;quot;Permit&amp;quot;&amp;gt;, &amp;lt;m &amp;quot;Granted&amp;quot;&amp;gt;) message all the&lt;br /&gt;
    time.&lt;br /&gt;
&lt;br /&gt;
Permits are released automatically.  When no more references to a particular Permit remain,&lt;br /&gt;
it is automatically released.  So you generally don&amp;#039;t need to call Release().&lt;br /&gt;
&lt;br /&gt;
Permits can be in one of three states:&lt;br /&gt;
 - \ref permitStates &amp;quot;REQUESTING&amp;quot;&lt;br /&gt;
 - \ref permitStates &amp;quot;GRANTED&amp;quot;&lt;br /&gt;
 - \ref permitStates &amp;quot;RELEASED&amp;quot;&lt;br /&gt;
&lt;br /&gt;
A permit is initially in the \ref permitStates &amp;quot;REQUESTING&amp;quot; state.  When the permit is granted,&lt;br /&gt;
it moves to the \ref permitStates &amp;quot;GRANTED&amp;quot; state.  When Release() is called, or the permit is&lt;br /&gt;
revoked, the permit moves to the \ref permitStates &amp;quot;RELEASED&amp;quot; state (A permit can be forced &lt;br /&gt;
directly to a \ref permitStates &amp;quot;RELEASED&amp;quot; state from \ref permitStates &amp;quot;REQUESTING&amp;quot;.)  A permit&lt;br /&gt;
can never be re-requested, you must obtain a new permit.  Permits are only revoked in exceptional&lt;br /&gt;
circumstances, but you don&amp;#039;t normally need to deal with this.&lt;br /&gt;
&lt;br /&gt;
See Also:&lt;br /&gt;
    GameObject, Junction::RequestTrackPermit(), Track::RequestPermitForTrain(),&lt;br /&gt;
    Trackside::RequestTrackPermit(), Train&lt;/div&gt;</summary>
		<author><name>Christopher824</name></author>
	</entry>
</feed>