Couldn't you just make 'hashover' into a global boolean?
Printable View
Couldn't you just make 'hashover' into a global boolean?
I suppose, but I would have to make things complicated, and unless you use the hack you mentioned, you'll lose the hoverboots until the next time you touch a ladder.
In light of this, I think it'll work best as a global script, which I'm just in the middle of preparing for general release.
Edit: I've updated the ladder script. It now uses a global script. More details on global scripts (as I require you to use them) here: Global OnStart Script
Got notified. I will be trying this out shortly. EDIT: Actually, I will be trying out that global script, the update to it.
Umm, please edit the link: "the ladder script." You are missing a "t" in between "c" and "u."
I did see a reason for that once, but I forget what it is now. Might be in the pinned threads in scripting discussion.Quote:
(which, by themselves, cannot run more than one frame for no particular reason)
Should that be and?Quote:
For your sake any mine,
And also, howcome you always declare booleans, then set them on the next line?
like that?Code:bool somethingfoo;
somethingfoo = true;
is just as acceptable isn't it?Code:bool somethingfoo = true;
All the reported typos are fixed (sheesh, my inner-dictionary must be out to lunch or something >_>)
I do variables like that because I thought you couldn't initialize them on the same line.
*tests*
... I coulda sworn I saw an error before... <_< updating scripts
Edit: And, actually, the example you pasted is a typo. Or, a copy-and-pasto, rather. I intended to just have the declaration, before I started copying and pasting stuff in my code blocks -_-'''
Anyway, fixed.
I have learned how a global script does in your neat tutorial site. There are problems with compiliation, here is how I set up your global script.The errors in Pass 3 were returned was:Code:bool ladderhashover;
bool onladder;
global script ladder {
void run() {
while(true) {
ladder(98);
Waitframe();
}
}
//Courtesy of Saffith/beefster09
bool isSolid(int x, int y) {
if(x<0 || x>255 || y<0 || y>175) return false;
int mask=1111b;
if(x % 16 < 8)
mask &= 0011b;
else
mask &= 1100b;
if(y % 16 < 8)
mask &= 0101b;
else
mask &= 1010b;
int ret = Screen->ComboS[ComboAt(x, y)] & mask;
return (ret!=0);
}
void ladder(int f) {
int lc;
lc = ComboAt(Link->X+8, Link->Y+15); //for speed
if(Screen->ComboF[lc] == f || Screen->ComboI[lc] == f) {
if(!onladder) {
ladderhashover = Link->Item[I_HOVERBOOTS];
Link->Item[I_HOVERBOOTS] = false;
onladder = true;
}
if(Link->Jump < 0) Link->Jump = 0;
if(Link->InputDown) {
if(!isSolid(Link->X, Link->Y + 16)) Link->Y += 1;
}
if(Link->InputUp) {
if(!isSolid(Link->X, Link->Y - 1)) Link->Y -= 1;
}
} else {
if(onladder) {
Link->Item[I_HOVERBOOTS] = ladderhashover;
onladder = false;
}
}
}
}
Quote:
TMP, LINE 37: ERROR S10: FUNCTION COMBOAT IS UNDECLARED.
TMP, LINE 45: ERROR S10: FUNCTION COMBOAT IS UNDECLARED.
TMP, LINE 49: ERROR S09: VARIABLE I_HOVERBOOTS IS UNDECLARED.
TMP, LINE 50: ERROR S09: VARIABLE I_HOVERBOOTS IS UNDECLARED.
TMP, LINE 63: ERROR S09: VARIABLE I_HOVERBOOTS IS UNDECLARED.
Tsk, tsk, import "std.zh", my friend.
I missed it from the tutorial, but, it should appear at the top of every .z file...
This is because you didn't tell ZC to import std.zh.
ComboAt is a utility routine, which turns a pixel reference number into coordinates for that pixel, and it's located in std.zh.
Also, why do you have Saffith's bool within your global script?
And how can you declare your own voids?
I don't think I understand voids very well...
I beat you to it, but:
The "isSolid" script is used by my script. That's why it's there. I credited it to Saffith and beefster09 because I didn't write it.
As for it's location, it could be moved to the global namespace (i.e. outside of any script), but it's not that big a deal.
Damn, I didn't notice =P
But won't it never be reached within that global script because of the loop? :confused: