• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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