Difference between revisions of "NML:Deprecated syntax"

From GRFSpecs
Jump to navigationJump to search
(explain the numeric parameter access briefly)
 
(General improvement, make clear that usage is not recommended)
Line 1: Line 1:
 
== Direct variable access ==
 
== Direct variable access ==
NML allows a syntax to directly access (unnamed) variables by their NewGRF number:
+
NML allows a syntax to directly access (unnamed) variables in a switch-block by their NFO number:
 
<pre>
 
<pre>
value = param[<num>, <bit>, <mask>, <param>]
+
var[<num>, <shift>, <mask>, <param>]
 
</pre>
 
</pre>
where <code><num></code> is the variable number, <code><bit></code> is the the first bit read from that variable, <code><mask></code> is a mask applied to the variable and <code><param></code> is only present for those variables which require a parameter.
+
where <code><num></code> is the NFO variable number, which is shifted <code><shift></code> bits to the right and then and-masked with <code><mask></code>. <code><param></code> is only present for those variables (0x60-0x7F) which require a parameter.
  +
  +
This syntax should only be used when the required variable is not implemented in NML. Unless the variable is added by an unofficial patch (which will not be supported by NML), it's highly recommended to instead file a feature request at the NML tracker to implement the variable there.

Revision as of 12:42, 14 September 2011

Direct variable access

NML allows a syntax to directly access (unnamed) variables in a switch-block by their NFO number:

var[<num>, <shift>, <mask>, <param>]

where <num> is the NFO variable number, which is shifted <shift> bits to the right and then and-masked with <mask>. <param> is only present for those variables (0x60-0x7F) which require a parameter.

This syntax should only be used when the required variable is not implemented in NML. Unless the variable is added by an unofficial patch (which will not be supported by NML), it's highly recommended to instead file a feature request at the NML tracker to implement the variable there.