• 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.

Question about ability ID.

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
Hey everyone. I have a question about ability ID.
Usually, ability ID looks like this "ABCD", which is consist of letters or both letters and numbers. But today I saw a Jass program online and the ability IDs are all in numeric forms, such as "0123456789" (10 digit number). Is it more efficient? How can I convert "ABCD" to"0123456789"?

Thanks a lot.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
When you write 'ABCD' (in single quotes) in jass, that's just another representation of an integer. The game probably converts it when reading the script or at least I know of no performance difference.

It's the ascii (256) system. Decimal representation of 'ABC0' would be:

A --> 65
B --> 66
C --> 67
0 --> 48

(Look up the characters in the ascii table)

Then result is 65*256^3+66*256^2+67*256^1+48*256^0

There are more reseprentations mentioned here.
 
Level 11
Joined
Oct 11, 2012
Messages
711
When you write 'ABCD' (in single quotes) in jass, that's just another representation of an integer. The game probably converts it when reading the script or at least I know of no performance difference.

It's the ascii (256) system. Decimal representation of 'ABC0' would be:

A --> 65
B --> 66
C --> 67
0 --> 48

(Look up the characters in the ascii table)

Then result is 65*256^3+66*256^2+67*256^1+48*256^0

There are more reseprentations mentioned here.
Thanks a lot for the help! Just one more question, what is the result of "65*256^3+66*256^2+67*256^1+48*256^0"?
Is it 1094861616? >_< I am really bad at math......
 
Status
Not open for further replies.
Top