XML for Newbies Part 7 - Other Useful Opertators
Posted: 05 Mar 2017, 21:05
Parts 1 through 6 are here - http://www.militaryaiworks.com/forums/33/16902
A few other useful operators.
a) rng = range
Rather than do a > and < to check if a values is between two other values, use rng.
10 100 (A:RADIO HEIGHT,feet) rng
Would check if the aircrafts current height is between 10 -> 100ft, and return TRUE ( 1 ) if it is.
b) scmp = string compare case sensitive
(A:ATC AIRLINE) 'Delta' scmp 0 ==
if{ A } els{ B }
Returns true and executes A if the ATC AIRLINE entry in the aircraft config file is Delta, else executes B
NOTE Why 0 == ?
Strings are subtracted so if they are the same the result is 0, checking for 0 == returns TRUE if the strings are the same.
c) scmi = string compare case insensitive
(A:ATC AIRLINE) 'DeLTtA' scmi 0 ==
if{ A } els{ B }
Returns true and executes A if the ATC AIRLINE entry in the aircraft config file is 'dEltA' in any upper/lower case combination.
NOTE Why 0 == ?
Strings are subtracted so if they are the same the result is 0, checking for 0 == returns TRUE if the strings are the same, else executes B
d) ssub = Find a substring
(A:ATC AIRLINE) 'elt' sstr 0 >
Checks for 'elt' in the aircraft config file ATC AIRLINE entry
If the entry contains 'elt' the result is TRUE (any number greater than 0 is a match)
NOTE - On string operators....
Originally I wanted to use them to check for the (A:AI TRAFFIC STATE, string) variables.
A subset of what is listed on the FSX variables page is supposed to be available to FS9.
As usual NONE of them can be used by AI aircraft, or at least I never got them to work.
Thanks Microsoft!
If you would like to experiment with the AI TRAFFIC STATE variables, they are listed here
https://msdn.microsoft.com/en-au/library/cc526981.aspx
The main list is FSX, the small list of 5 is FS9.
A good place to start is..
<code>
(A:AI TRAFFIC STATE, string) 'axi' sstr 0 >
if{ 1 } els{ 0 }
</code>
This should check for 'axi' in the current TRAFFIC STATE string, but as I said it doesn't seem to work!
Which either means the code is wrong or as I suspect AI Aircraft can't use those variables.
A few other useful operators.
a) rng = range
Rather than do a > and < to check if a values is between two other values, use rng.
10 100 (A:RADIO HEIGHT,feet) rng
Would check if the aircrafts current height is between 10 -> 100ft, and return TRUE ( 1 ) if it is.
b) scmp = string compare case sensitive
(A:ATC AIRLINE) 'Delta' scmp 0 ==
if{ A } els{ B }
Returns true and executes A if the ATC AIRLINE entry in the aircraft config file is Delta, else executes B
NOTE Why 0 == ?
Strings are subtracted so if they are the same the result is 0, checking for 0 == returns TRUE if the strings are the same.
c) scmi = string compare case insensitive
(A:ATC AIRLINE) 'DeLTtA' scmi 0 ==
if{ A } els{ B }
Returns true and executes A if the ATC AIRLINE entry in the aircraft config file is 'dEltA' in any upper/lower case combination.
NOTE Why 0 == ?
Strings are subtracted so if they are the same the result is 0, checking for 0 == returns TRUE if the strings are the same, else executes B
d) ssub = Find a substring
(A:ATC AIRLINE) 'elt' sstr 0 >
Checks for 'elt' in the aircraft config file ATC AIRLINE entry
If the entry contains 'elt' the result is TRUE (any number greater than 0 is a match)
NOTE - On string operators....
Originally I wanted to use them to check for the (A:AI TRAFFIC STATE, string) variables.
A subset of what is listed on the FSX variables page is supposed to be available to FS9.
As usual NONE of them can be used by AI aircraft, or at least I never got them to work.
Thanks Microsoft!
If you would like to experiment with the AI TRAFFIC STATE variables, they are listed here
https://msdn.microsoft.com/en-au/library/cc526981.aspx
The main list is FSX, the small list of 5 is FS9.
A good place to start is..
<code>
(A:AI TRAFFIC STATE, string) 'axi' sstr 0 >
if{ 1 } els{ 0 }
</code>
This should check for 'axi' in the current TRAFFIC STATE string, but as I said it doesn't seem to work!
Which either means the code is wrong or as I suspect AI Aircraft can't use those variables.