HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit Codes

09-12-2009, 01:17 AM#1
Storyyeller
How do you convert a unit code to an integer and vice versa?

Is there anyway to do it automatically in JNGP?


Also, if so, what other conversion options are there in JNGP? For example, is it possible to automatically convert all hexadecimal literals to decimal?
09-12-2009, 01:23 AM#2
Earth-Fury
if by "unit code" you mean a unit's rawcode, defined in the form: 'hfoo' in JASS, then... they already are integers. 4 chars at 8 bits each (1 bytes) = 32 bits, the length of an integer in JASS.
09-12-2009, 02:20 AM#3
Storyyeller
Yes, I know unit codes are just a pretty form of integer. I was wondering how you convert their representation inside the trigger editor.

For example, with something like CreateUnit(Player(p), $6E303035 ,0,4032,270), it is difficult to figure out what it is doing at a glance. It is much nicer to be able to view it as a unit code instead of the raw integer value, or even worse, the hexidecimal value.
09-12-2009, 02:43 AM#4
Earth-Fury
... err
Collapse JASS:
call CreateUnit(Player(0), 'hfoo', 0, 0, 0)

?

Because that does work, you know...
09-12-2009, 04:10 AM#5
Storyyeller
But is there any way to automatically replace all of those throughout the code?
Converting even one unit code by hand is a pain, let alone 100.
09-12-2009, 06:10 AM#6
0zyx0
Why do you have to convert them anyway? And no, JNGP doesn't have that feature, BUT w3c map optimizer can convert ASCII codes to decimal values. However, that's only useful if you are going to release a map (if even then), so it is probably not what you want.