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

Numbering system / base used for object ids

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hi,

What base or numbering system does Warcraft 3 use for numbering/ordering object ids (in particular custom made object ids)?

For example I notice that 'B001' is considered less than 'B000' and likewise 'B005' is apparently less than 'B003.' So how are these ordered?
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
They order them by increasing the last value.

This 'B001' is not less than this 'B000'

But you have to watch when doing something with the order as JNGP can use any unused 4 digit ASCII value as the new Raw Data values.

Alright so if I set an object to 'B001', should not the id for a newly generated object immediately after that be 'B002' ? And I'm guessing it goes 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ?

So something like base-36?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
the formula is veeery simple:

Take ascii value of all 4 chars, ascii1, ascii2, ascii3, ascii4

Result = (((((ascii1 * 256) + ascii2) * 256) + ascii3) * 256) + ascii4

and yes it uses base 256, so it goes through whole ascii list

note: if you use JNGP, never put /* or */ into rawcodes, because JNGP doesnt like 'a/*b'
 
Status
Not open for further replies.
Top