PDA

View Full Version : Can ZScript store and return hexadecimal values?



Nimono
11-19-2007, 04:30 PM
Like the title says. I was thinking of trying to make something that would convert a decimal value to a hexadecimal value to work with Link->Warp and Link->PitWarp. However, since these are the only two functions I can think of that use hex values, I have a feeling that we're not allowed to store hex values in variables. (Which would therefore be stupid, because we'd have no way to make one script warp you to different locations when different conditions are met.) So... I really need to know this. Thanks in advance!

Joe123
11-19-2007, 06:15 PM
After that conversation at #PureZC, I've come up with this:


int ScreenAt(int y, int x){
return (x + (y*16));
}

Try adding that to the start of your ZScript document, then using it like ComboAt. It should directly reference coordinates as in ZQuest, so if you wanted to go to screen 3,1 you'd put:
Link->PitWarp(Dmap, ScreenAt(3,1));

and if you wanted to go to screen 2,F you'd put:
Link->PitWarp(Dmap, ScreenAt(2,15));

I think this should work anyway, I've tested it and it seems to.

The coordinates for the Link->Warp and Link->PitWarp command isn't in hexadecimals, it's an integer that goes up as you move along the screens, so as I said in that other thread:

00,01,02,03...0E,0F
10,11,12,13...1E,1F
in ZQuest (and I think that's hexadecimals, right?)

for Link->Warp would be:

0 ,1 ,2 ,3 ... 14,15
16,17 ,18 ... 30,31

And I know that _L_ said it was in hexadecimals, and it may work if you try and put hexadecimals into it, but it definately does work as I've just said, because I've been using it like that before.

DarkDragon
11-19-2007, 07:57 PM
I know this has also been a point of confusion in the past, but the numbers in ZScript (or in any programming language) do not have any inherent base. You, as the programmer, can choose any representation you want.

Here's a snippet:


Link->Warp(1,15);
Link->Warp(1, 0xF); //this does the same thing
Link->Warp(1, 1111b); //this does the same thing
int i = 17;
int j = 0x11;
if(i == j)
{
//always true
}

i = i + 0xA;
Trace(i); // prints 27

_L_
11-20-2007, 09:18 AM
P.S: There's no octal representation. Just so you know.

Gleeok
12-13-2007, 07:33 AM
Well how can the same Dmap coordinates be used for multiple screens then? This makes less sense more and more.


Decrypting...okay.
Opening...okay.
Loading Quest...

Decrypting...okay.
Opening...okay.
Loading Quest...

Decrypting...okay.
Opening...okay.
Reading Header...okay.
Reading Rules...okay.
Reading Strings...okay.
Reading Doors...okay.
Reading DMaps...okay.
Reading Misc. Data...okay.
Reading Misc. Colors...okay.
Reading Game Icons...okay.
Reading Items...okay.
Reading Weapons...okay.
Reading Maps...okay.
Reading Combos...okay.
Reading Combo Aliases...okay.
Reading Color Data...okay.
Reading Tiles...okay.
Reading Tunes...okay.
Reading Cheat Codes...okay.
Reading Init. Data...okay.
Reading Custom Guy Data...okay.
Reading Custom Link Sprite Data...okay.
Reading Custom Subscreen Data...okay.
Reading FF Script Data...okay.
Reading SFX Data...okay.
Done.
0.0000
56.0000
0.0000
0.0000
0.0000
1.0000
0.0000
2.0000
0.0000
3.0000
0.0000
4.0000
0.0000
5.0000
0.0000
6.0000
0.0000
7.0000
0.0000
8.0000
0.0000
9.0000
0.0000
10.0000
0.0000
11.0000
0.0000
12.0000
0.0000
13.0000
0.0000
14.0000
0.0000
15.0000
0.0000
8.0000
0.0000
9.0000
0.0000
10.0000
0.0000
11.0000
0.0000
12.0000
0.0000
13.0000
0.0000
14.0000
0.0000
15.0000
0.0000
16.0000
0.0000
17.0000
0.0000
18.0000
0.0000
19.0000
0.0000
20.0000
0.0000
21.0000
0.0000
22.0000
0.0000
23.0000
0.0000
16.0000
0.0000
16.0000
0.0000
17.0000
0.0000
18.0000
0.0000
19.0000
0.0000
20.0000
0.0000
21.0000
0.0000
22.0000
0.0000
23.0000
0.0000
24.0000
0.0000
25.0000
0.0000
26.0000
0.0000
27.0000
0.0000
28.0000
0.0000
29.0000
0.0000
30.0000
0.0000
31.0000
0.0000
24.0000
0.0000
25.0000
0.0000
26.0000
0.0000
27.0000
0.0000
28.0000
0.0000
29.0000
0.0000
30.0000
0.0000
31.0000
0.0000
32.0000
0.0000
33.0000
0.0000
34.0000
0.0000
35.0000
0.0000
36.0000
0.0000
37.0000
0.0000
38.0000
0.0000
39.0000


ffc script trace_map{

void run(){

float map;
float screen;

map = Game->GetCurDMap();
screen = Game->GetCurDMapScreen();
Waitframe();
Trace(map);
Trace(screen);

Waitframes(10);
}
}

I finally got fed up and traced int map(0), and int screen, then proceeded to walk from 0,0 -to-0f. *warped to* 1,0 then walked to 1f */repeat*

According to this, screen 08 is the same as 10....@_@ ..wtf..., but screen 10 has bushes, bushes I say!!!!!! Mwahahahahhhhhhahahahha!!!!!!!!!!

Gleeok
12-14-2007, 04:10 AM
Hey Joe123, can you explain just how the heck you are even able to warp ..say, to dmap screen 12 if your not using hexi?