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

Comparing an Integer to a Char?

Status
Not open for further replies.
Level 3
Joined
Dec 31, 2008
Messages
46
JASS:
	loop
		set a[i]=0
		set i=i+1
		exitwhen i>='d'
	endloop

I'm working on reverse engineering a map file, and I'm very confused with how i will compare with the character. o-O

FYI I'm not a jass pro.
 
Level 3
Joined
Dec 31, 2008
Messages
46
I now know it won't compile, but this is what came up after decompressing the file, I was just curious as to what it was doing.
 
Level 6
Joined
Oct 1, 2012
Messages
166
Well, wait. Firstly, I've never seen char in JASS. Always figured it's just strings (somehow reverse C).

You could make some custom functions, one to convert integer to string (gets integer a, returns, say "b" if your integer equals 2), you could make on the other way around and then other function comparing your chars (strings). Say function WitchCharIsBigger(string a, string b) will give TRUE if a is after b in the alphabet and, in this function, you would need to convert those strings to integers and then compare integers.

What I wrote is kinda messed up, I know, but I can write functions for you, if you like.
 
Level 5
Joined
Oct 27, 2007
Messages
158
JASS:
    loop
        set a[i]=0
        set i=i+1
        exitwhen i>='d'
    endloop

I'm working on reverse engineering a map file, and I'm very confused with how i will compare with the character. o-O

FYI I'm not a jass pro.

Same as...

JASS:
loop
set a[i]=0
set i=i+1
exitwhen i>=100
endloop

FYI it's not a character but a base 256 number.
Rawcode ID's are base 256 numbers in WC3.
When you lookup the character d in the ASCII table, you'll see the value 100d or 64h

256 ^ 0 * 100 = 100

Rawcode 'dddd' would be...

(((256 ^ 3) * 100) + ((256 ^ 2) * 100) + ((256 ^ 1) * 100) + ((256 ^ 0) * 100))

integer base 10 value of 'dddd' is 1677721600 + 6553600 + 25600 + 100 = 1684300900
 
Status
Not open for further replies.
Top