In addition to SELF and PARENT, switches for vehicle features may use one of the following types below.<br/>
(These are mostly the same as in <ahref="https://newgrf-specs.tt-wiki.net/wiki/NML:Random_switch">random_switch</a>).<br/>
The 'x' parameter (count x vehicles in given direction) is currently required to be a compile-time constant between 0 and 255.
<table>
<tr><th>Type</th><th>Meaning</th></tr>
<tr><td>BACKWARD_SELF(x)</td><td>Count x vehicles backward (away from the engine), starting at the vehicle itself</td></tr>
<tr><td>FORWARD_SELF(x)</td><td>Count x vehicles forward (towards the engine), starting at the vehicle itself</td></tr>
<tr><td>BACKWARD_ENGINE(x)</td><td>Count x vehicles backward, starting at the leading engine</td></tr>
<tr><td>BACKWARD_SAMEID(x)</td><td>Count x vehicles backward, starting at the first vehicle in the chain with the same ID</td></tr>
</table>
<p>These require the <spanclass="code">more_varaction2_types</span> feature. If this feature is not present, switches of these types will produce a CB_FAILED result.</p>
<p>Additional variational action 2 types are indicated by the feature name: <fontface="monospace">more_varaction2_types</font>, this document describes version 1.<br/>
This feature name must be tested for to enable this feature.</p>
<p>See the <ahref="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2#Type">Variational Action 2 Specification (types)</a> for background information.</p>
<p>This feature adds the type value 87, for additional variation action 2 modes/scopes. (This is used instead of the standard values: 81, 82, 85, 86, 89 or 8A).<br/>
An additional byte follows to specify which sub-type.</p>
<tr><td>01</td><td>Relative scope for vehicles (same syntax as <ahref="https://newgrf-specs.tt-wiki.net/wiki/RandomAction2#80.2F83.2F84">random action 2 type 84</a>)</td></tr>
<tr><td>02</td><td>Relative scope for vehicles (longer syntax)</td></tr>
</table>
<p>If an unknown sub-type is used, or if subsequent sub-type bytes are invalid, a callback failure group is created, the same as sub-type 00.</p>
This produces a callback failed result in all cases (appropriate whether or not variable 0C is currently 0).<br/>
This can be used to avoiding needing to branch on variable 0C or create empty (feature-dependant) real sprite/sprite layout/industry production groups.
</p>
<h4id="varaction2_additional_type_01">Sub-type 01: Relative scope for vehicles (random action 2 type 84 syntax)</h4>
<p>The vehicle which is accessed can be any in the vehicle consist. The <fontface="monospace">count</font> byte selects which, this has the same syntax and functionality
as the <ahref="https://newgrf-specs.tt-wiki.net/wiki/RandomAction2#count"><fontface="monospace">count</font> byte in random action 2 type 84</a>.</p>
<p>Note: The count byte mode where temporary variable 0x100 is used should be used with caution.</p>
<h4id="varaction2_additional_type_02">Sub-type 02: Relative scope for vehicles (longer syntax)</h4>
<p>The vehicle which is accessed can be any in the vehicle consist. The <fontface="monospace">mode</font> and <fontface="monospace">offset</font> bytes select which.</p>
<p>The <fontface="monospace">mode</font> byte has the following syntax:
<table>
<tr><th>Bits</th><th>Meaning</th></tr>
<tr><td>0 - 1</td><td>
Selection mode:<br/>
These values are the same as bits 6 - 7 of the <ahref="https://newgrf-specs.tt-wiki.net/wiki/RandomAction2#count"><fontface="monospace">count</font> byte in random action 2 type 84</a>.
<table>
<tr><th>Value</th><th>Meaning</th></tr>
<tr><td>0</td><td>Count back (away from the engine), starting at this vehicle</td></tr>
<tr><td>1</td><td>Count forward (toward the engine), starting at this vehicle</td></tr>
<tr><td>2</td><td>Count back, starting at the engine</td></tr>
<tr><td>3</td><td>Count back, starting at the first vehicle in this chain of vehicles with the same ID, as for vehicle variable 41</td></tr>
</table>
</td></tr>
<tr><td>7</td><td>If set, use variable 0x100 for the offset. The offset byte must be 0.</td></tr>
</table>
The remaining bits are reserved for future used and must be set to 0.
</p>
<p>The <fontface="monospace">offset</font> byte specifies how far to count from the starting vehicle. A value of 0 is not special.<br/>
Bit 7 of the <fontface="monospace">mode</font> byte must be set to use temporary variable 0x100 instead.</p>
<p>Note: Using temporary variable 0x100 as the offset should be used with caution.</p>