Hey everyone...
I wrote this script for an addon of mine - the Australian Defence Forces ARH Tiger
What it does is detects the Speed/Altitude of a helicopter and then changes the Heads up Display as needed.
_heli = _heli select 0
#loop
? ! isengineon _heli: goto "end"
_alt = getpos _heli select 1
_speed = speed _heli
? _alt > 9999 : _alt = ["e","e","e","e"], goto "next"
? _alt < 0 : _alt = [0,0,0.0], goto "next"
#next
? _speed > 9999 : _alt = ["e","e","e","e"], goto "display"
? _speed < 0 : _alt = [0,0,0,0], goto "display"
#display
_heli setobjecttexture [6, format ["\ADF_ARHtiger\hud\num%1.paa", _alt select 0]]
_heli setobjecttexture [7, format ["\ADF_ARHtiger\hud\num%1.paa", _alt select 1]]
_heli setobjecttexture [8, format ["\ADF_ARHtiger\hud\num%1.paa", _alt select 2]]
_heli setobjecttexture [9, format ["\ADF_ARHtiger\hud\num%1.paa", _alt select 3]]
_heli setobjecttexture [10, format ["\ADF_ARHtiger\hud\num%1.paa", _speed select 0]]
_heli setobjecttexture [11, format ["\ADF_ARHtiger\hud\num%1.paa", _speed select 1]]
_heli setobjecttexture [12, format ["\ADF_ARHtiger\hud\num%1.paa", _speed select 2]]-
_heli setobjecttexture [13, format ["\ADF_ARHtiger\hud\num%1.paa", _speed select 3]]
~0.5
goto "loop"
#end
_heli setobjecttexture [6, ""]
_heli setobjecttexture [7, ""]
_heli setobjecttexture [8, ""]
_heli setobjecttexture [9, ""]
_heli setobjecttexture [10, ""]
_heli setobjecttexture [11, ""]
_heli setobjecttexture [12, ""]
_heli setobjecttexture [13, ""]
exit
disregard the 'setobjecttexture' line it is of no importance to the problem.
basicly i have the altitude of the helicopter (stored as "_alt")
so lets assume...
_alt = 1234
now what i want to do is seperate _alt into it's digits for instance
_alt = [1,2,3,4]
like this, I can use a format command to select the digit I want and using that number I can run the setobjecttexture line. (don't worry about how I do this, I understand it)
_heli setobjecttexture [6, format ["\ADF_ARHtiger\hud\num%1.paa", _alt select 0]]
so in simple words i want to know a method to select single digits out of a multiple digit number or convert a number to a string as I showed.
Number to String Conversion
but how the fornicate do I do it?
Thanks for you help guys
Reed