Ability id to integer?

Status
Not open for further replies.
I understand Gui does not take Ability id as integer but Jass does, right?.

I was trying to do this:

Set the Custom Value of (Triggering Unit) to (Ability being cast)

I could not do it in Gui, but i fix it like this ^^:

Custom Script: call SetUnitUserData( GetEnumUnit(), GetSpellAbilityId() )

Thanks for the answers.
 
No. Jass can't take it as integer either, since ability ID is not made out of numbers only, and if you try to convert it to any other type you'll phail aswell. That's what happened to my try atleast.

It actually is made out of numbers only...

I guess if you want a fast way to convert it you just do something like:

JASS:
function A2I takes integer abilityid returns integer
    return abilityid
endfunction

//

local int abil = A2I('A000')

// that, however, would be really useless as you could just as easily do:
local int abil = 'A000'
 
serbianbeast said:
since ability ID is not made out of numbers only, and if you try to convert it to any other type you'll phail aswell.
Actually you can convert abilityid to integer, like the way Eleandor suggests. I have done this quite a lot of times and it does work flawlessly.
 
It's basically because 'A000' is just a number but in another base. Like BASE10 contains cyphers from 0 to 9, BASE 16 contains cyphers from 0 to 9; A to F, and I think those id's are in base 256 (or 128, but I think 256). Since there are only 62 alphanumeric characters, you can only use 62/256 possible id's for abilities, items, units. I'm assuming the other possible id's are unused or are used for stuff like the move-orderid, stop-orderid etc.
 
thats Im a mindless zombie
hmm I should seek for brains... or super good flash games... definetly flash games
Must Pleaeeaeeay
 
Yeap, it has an offset.
Never really tested it before - didn't need to.
So the base '0010'-'0000' which is equal to 256.
 
'****' where **** are any ASCII character from 0 to 256 will always return an integer and can be manipulated like one.
To be exact '****' represents a 32 bit unsigned integer (8 bits per letter and thus 256 different characters per letter).

Converting from one to a propper number before saving your map is pointless and not worth the effort as it yields no speed benifit ingame (should not atleast as they should both compile to the same value) and also it just uses up more map size. They however should not be as easy for WC3 to compile and so should be slower than normal numbers (especially if used to represent a small number), but if so then the difference is unnoticable.
 
Status
Not open for further replies.
Back
Top