hashtable parrent issued order, value unit type?

Status
Not open for further replies.
S2I converts a number string to integer, integer i = S2I("521")
You need to use other order function that converts an order to integer, String2OrderIdBJ("humanbarracks")
 
S2I converts a number string to integer, integer i = S2I("521")
You need to use other order function that converts an order to integer, String2OrderIdBJ("humanbarracks")

This is wrong, not sure exactly why, but i Load 0 instead of the unit type.

JASS:
set i = LoadInteger(hash, GetIssuedOrderId(), 0)

call SaveInteger(hash, OrderId("humanbarracks"),0,'hbar')

and if it can't find a match it will return 0 right? Debug states this statement is correct.
 
Last edited:
No it is not wrong, I told you to use BJ function but you tried to be cool and didn't use it.You can look into BJ function for more details.
 
Just to round off with the reason why the BJ was used...
JASS:
function String2OrderIdBJ takes string orderIdString returns integer
    local integer orderId
    set orderId = OrderId(orderIdString)
    if (orderId != 0) then
        return orderId
    endif
    set orderId = UnitId(orderIdString)
    if (orderId != 0) then
        return orderId
    endif
    return 0
endfunction
There are two separate natives used to convert order strings into order id numbers. In this case it must be using the native "UnitId" instead of "OrderId". As such it should be possible to inline with "UnitId" for better performance.
 
Status
Not open for further replies.
Back
Top