HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Converting: OrderId(Unit) -> String

12-27-2003, 12:02 AM#1
Vidstige
Does anyone know of an easy way to get a string representation of the order ids returned from GetUnitCurrentOrder takes unit returns ineger?

What I want to do is
Code:
function InspectUnit takes unit u returns nothing
        local integer typeId = GetUnitTypeId(u)
        local integer order = GetUnitCurrentOrder(u)
        local string s = ""
        set s = s + Id2Str(typeId) + ": "	
        set s = s + Order2Str(order) + " "	
        call print(s)
endfunction
and get a nice result like:
hpea: autoharvestgold
instead of the ugly result
hpea: 852019 :nono:

Any suggestions anyone?
12-27-2003, 12:10 AM#2
AIAndy
There is a native for that: OrderId2String
It will return the order string if it exists.
12-27-2003, 12:15 AM#3
Vidstige
:////
Uhm, I meant somthing that works from an ai-script. Thanks anyway.
12-27-2003, 12:33 AM#4
AIAndy
From inside an AI script I can see no easy way to do that as the necessary information is missing. The only solution I can see is making a large table with the unit strings and their corresponding ids and then use your precompiler to turn that into code. But that is a lot of work unless that table already exists somewhere.
BTW, how is the precompiler going? So far it works fine. The last important thing I'd need is that different ROW variable that increases only when the condition evaluates to true.
12-27-2003, 12:43 AM#5
Vidstige
I guess it's time to create different tables like crazy using the #includetable. Will try to get new version out before end of year.