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

Simple jass question - spell code as int?

Status
Not open for further replies.
Level 6
Joined
Sep 9, 2006
Messages
92
just wondering if someone could explain how this works:
JASS:
constant function DotRM_DotRM_code takes nothing returns integer
//*************************************************************************************************
//Ability-Code for Dance of the Red Moon                                                         **
    return 'A000'                                                                              
//*************************************************************************************************
endfunction
(taken from Dance of the Red Moon, a cool spell i found on here a while back)

the function returns an integer, yet it reterns 'A000'... how is that an integer?

(i'm new to jass, just made my first simple spell today [damages target and heals self], just starting to explore KaTTaNa's handle vars system, and was looking at this spell as an example)
 
just wondering if someone could explain how this works:
JASS:
constant function DotRM_DotRM_code takes nothing returns integer
//*************************************************************************************************
//Ability-Code for Dance of the Red Moon                                                         **
    return 'A000'                                                                              
//*************************************************************************************************
endfunction
(taken from Dance of the Red Moon, a cool spell i found on here a while back)

the function returns an integer, yet it reterns 'A000'... how is that an integer?

(i'm new to jass, just made my first simple spell today [damages target and heals self], just starting to explore KaTTaNa's handle vars system, and was looking at this spell as an example)

I guess that is a base 256 integer or something... but why would you want to know anyway?
 
cuz just learning jass it seems weird to have a letter = an integer lol

so I guess you have no knowledge about numbers using other bases and not the decimal one. Computers uses only 0,1 (binary integers). There are also others which uses (numbers + letters) like that one and the hexadecimal system (uses 0-9 then A-F). Hexadecimal system is used to represent the binary system in a more "human-friendly" way.


BTW I learned those in a basic IT class(they just taught us how to type in MSWord and other basic things...)
 
Well there are 26 characters in the alphabet, and two possible cases (upper/lower-case) in addition to 10 digits. This leaves us with a base 62 (not to mention symbols).

well I'm not sure of the base they use. 256 is used by bytes. and bytes are converted to hexadecimal(that's their basic use according to wikipedia)
 
Level 6
Joined
Sep 9, 2006
Messages
92
so I guess you have no knowledge about numbers using other bases and not the decimal one. Computers uses only 0,1 (binary integers). There are also others which uses (numbers + letters) like that one and the hexadecimal system (uses 0-9 then A-F). Hexadecimal system is used to represent the binary system in a more "human-friendly" way.

i learned of hexadecimal after a bit of dealing with the editor's color system for text and after writing out a chart in 8th grade of hexadecimal numbers up to i don't remember, but it took up 3 or 4 pages, and i glanced over a jass tutorial about the bases but didn't quite understand this part i guess.. i now remember seeing things like saving hexadecimal numbers as integers as in x = 0xff i think it was
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
A byte is 8 bits. A bit is a 0 or a 1.

I suppose you could think of a byte as base-256 however that is like considering "10" as base-4.

Byte = 00000000 (value of 0)
Byte = 11111111 (value of 255)

Both of these are binary, or base-2.
 
Last edited:
Status
Not open for further replies.
Top