Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Sidescroll Ladder Script

61 replies · 10,990 views · Started 13 December 2007

Hey guys, this is my first post here. I recognize a lot of people.

Anyway, I need a script made for sidescroll ladders.
I need either a combo type or a flag that, when Link stands on it, he won't fall with "Sideview Gravity" checked. Kind of like the ladders in Link's Awakening.

I made the same request at PZC but I heard that there are some expert scripters here.
Can anyone make the script?

Ok, done. It's very basic, but very easy to use. Just assign the script to any old FFC, and you're done.

http://zctut.com/ladder.php - Archived on my site

It uses flag #98 (the first of the flags set aside just for scripts), but you can change that by passing the flag number in to D0.

As a bonus, I was going to throw in an option of forcing Link to face up while on a ladder (a la Gameboy Zeldas), but Link is not very flexible, and I ended up having to re-invent his movement and collision detection, and it was buggy anyway. So, I just left it at that.

Wait, so all we have to do is attack the script to any FFC in the screen. Then how does it know what combos are the ladder combos?

Finally. Real ladders. And combined with Joe's script, we have treu sideview ladders. Is there anything scripting can't do?

russadwan wrote:Finally. Real ladders. And combined with Joe's script, we have treu sideview ladders. Is there anything scripting can't do?

Yes, but there's always a workaround.

Hey, pkmnfrk:

I have been trying out the script you made for one of my quests. It's wonderful... 😊 but can you make an improvement?

I found a flaw. Using the script while Link has Z3 (diagonal) movement, when he walks at the bottom of the ladder in a gravity screen and it is a solid floor with no flag, he walks in one solid tile down.

You can reply here, but I liked to be notified too because I don't come here often, so send in a PM to me also.

Oohh... huh. I was hoping to avoid having to check for diagonals... Hmm, let me think on this...

zcAmazing wrote:You can reply here, but I liked to be notified too because I don't come here often, so send in a PM to me also.

There is a thread subscription option. I'll send you a PM once, if/when I update the script.

It doesn't work!

Compile Progress wrote:PASS 1: PARSING
LINE 41: SYNTAX ERROR, UNEXPECTED $END, EXPECTING RBRACE, ON TOKEN
FATAL ERROR P00: CAN'T OPEN OR PARSE INPUT FILE!

-- PRESS A KEY --

pkmnfrk, when going on the ladder with flag 98's for that sideview ladder script while Link has the Hover Boots item, as he goes up, the Hover Boots takes effect repeatedly. As he goes down, he acts flickering funny. Can you add to your script that prohibits the use of Hover Boots when Link is on Flag 98?

Yes, I can. But, I just thought about it, and there isn't really any foolproof method of ensuring that Link has the hover boots when he leaves the screen. Consider this:

bool hashover;
hashover = Link->Item[I_HOVERBOOTS];

while(true) {
//...
if(this combo is 98)
Link->Item[I_HOVERBOOTS] = false;
else
Link->Item[I_HOVERBOOTS] = hashover;

Waitframe();
}

This code works great as long as Link is on the screen. And, heck, if he leaves the screen while not on a ladder. However, if he leaves via a warp on a ladder (a very common thing one would do), then the last thing it would do is take away his boots, and then the script dies!

The only thing I can suggest is disabling the hoverboots on screens with ladders, OR waiting until 2.5+ to get real ladders.

No, that wouldn't work. Look again at my code. It records whether Link has the hover boots or not, and then goes on. In the loop, if Link's on a ladder, it takes away the hover boots. Otherwise, it gives him <whether or not he had them when the loop started>.

So, if he warps away while on a ladder, he won't have the boots. Then, the next copy of th script will check, and see that he doesn't have the boots. Then, it'll give him either no boots, or no boots. Which is the problem.

Now, that said, I suppose I could make this into a global script, which doesn't die with a screen. Let me work on that for a bit...

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

(which, by themselves, cannot run more than one frame for no particular reason)

I did see a reason for that once, but I forget what it is now. Might be in the pinned threads in scripting discussion.

For your sake any mine,

Should that be and?

And also, howcome you always declare booleans, then set them on the next line?

bool somethingfoo;
somethingfoo = true;

like that?
bool somethingfoo = true;

is just as acceptable isn't it?

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.

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 &#37; 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;
}
}
}
}

The errors in Pass 3 were returned was:
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? 😕