HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hexadecimal literals in vJass?

09-09-2009, 09:14 PM#1
Storyyeller
According, to the page Fledermaus linked too, JassHelper 0.9.F.7 and later support the use of $ for hexidecimal numbers.

However, when I tried it, it comes up with an error, even though I have version 0.9.I.2 (the latest one I could find)

Hidden information:
09-09-2009, 09:42 PM#2
Anitarf
Why is the decimal notation inadequate for what you are trying to do?
09-09-2009, 10:05 PM#3
Storyyeller
I was just wondering why it wouldn't work.

It won't let my inject config either.
09-09-2009, 10:26 PM#4
cosmicat
Hmm, maybe try '$$A2' (with single quotes)?

Or maybe it's supposed to be $A2$ .

Edit: Sorry, too lazy to find and actually read what you're talking about, and I don't have access to a World Editor for a while, so I can't test anything either. :P

Edit 2: I'd be extremely surprised if the first one worked, because I just remembered that single quotes are in base-256 (ASCII) and not hexadecimal.
09-09-2009, 11:55 PM#5
Captain Griffen
Doesn't the WC3 compiler already compile 0x as hexidecimal...? Do correct me if I'm wrong.
09-10-2009, 12:49 AM#6
Storyyeller
Well if the vJass manual says it supports $, why doesn't it? I feel like I somehow messed up my version or something. Especially since it won't let me inject either. What is going on?

Even if there are other ways to make hexadecimal constants, the inability to use a custom config function is really annoying.
09-10-2009, 01:03 AM#7
Earth-Fury
Collapse JASS:
function config takes nothing returns nothing




endfunction

from:
Collapse JASS:
//! inject config

//! endinject

So you're screwing it up somehow.

As for why $ doesn't work... Who cares? 0x<HEX> is the standard in the programming world... why would you need a second notation to do the same thing?
09-10-2009, 01:29 AM#8
cosmicat
Hmm, the manual indicates that "wc3 always did" allow $ as a prefix, so probably all that's changed is that JassHelper doesn't check for it anymore. Perhaps the new patch changed that.

Or maybe the problem is that it's a global constant. Test whether it works as a local integer...
Also, test whether the number of digits matters. It's possible that you need a certain number to make it work; last time I opened WE (a couple months ago, honestly) you could only do 'A000' or 'Z'. 'F0O' was unacceptable. Try $FFFFFF or just $F or perhaps $xFFFFFF (maybe that's what 'prefix' meant there).

And yeah, I'd agree that it's a rather insignificant point anyway, since 0xFFFFFF works just as well and often so does base-10. But it is curious, since the JassHelper manual indicates that $F is an acceptable notation.
09-10-2009, 02:09 AM#9
Storyyeller
I figured out the problem with the config injection. I wasn't putting a space between after the //!s

As for the $ thing, the main reason I was interested about it was because I saw a map in which $ type hexadecimal literals were used extensively and I was wondering why the same code would not work in vJass.

The map uses numbers anywhere from 1 to 8 digits, including some that are numerals only and some that are letters only. I don't think it's any specific properties like that that is causing the problems. Also, they were all stuff like $A or $65 or $3B9AC9FF or whatever. There weren't any xs involved.
09-10-2009, 02:47 AM#10
Vexorian
jasshelper supports $ correctly.

Your PJass is the one not supporting $.

So, change your Pjass with one that supports it.

I am not sure if Pitzermike ever added $ support to PJass though.

So , maybe use Zoxc's syntax checker instead?


You can also use WarCiTy, export the script, and mass replace all $ with 0x (then use WarCiTy to import the new one )