• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Ability id to integer?

Status
Not open for further replies.
Level 3
Joined
Dec 14, 2008
Messages
41
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.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
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'
 
Level 4
Joined
Nov 25, 2008
Messages
76
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.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
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.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
thats Im a mindless zombie
hmm I should seek for brains... or super good flash games... definetly flash games
Must Pleaeeaeeay
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Yeap, it has an offset.
Never really tested it before - didn't need to.
So the base '0010'-'0000' which is equal to 256.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
'****' 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.
Top