Bug-Filled Ladder Script

if (playerenters) {
this.laddersizex=1; 
this.laddersizey=7; 
}
if (playertouchsme) {
disabledefmovement;
if (playerdir == 2)playery += 3;
setani climb, ;
timeout = 0.8; // Necessary time, anything else won't really work. 
}
if(timeout){
if(playerx>=x-0.8 && playerx<x + this.laddersizex && playery>y && playery<y + this.laddersizey){
if (keydown(0))playery -= 0.8;
else if (keydown(2))playery += 0.8;
timeout = 0.8;
}
else {
setlevel2 room2.nw,30,33; // I feel like this leads to several errors.
enabledefmovement;
}
}

I would do something like this:

if (playertouchsme) { this.climbing=1; #position player to be lined up with ladder here setani climbing,; } while (this.climbing==1) { if (player presses up) playery--; if (player presses down) playery++; if (player is not on ladder anymore) { this.climbing=0; setani idle,; } sleep .05; }

you could also wrap the whole thing in a loop and change the playertouchsme into something checking the player’s x,y. that way it will look smoother. maybe.

That is so incredibly bad, hosler, assuming that wasn’t the intention. Timeouts exist for a reason.

what’s wrong with a while loop? while loops allow the script to ‘reset’ easier because you don’t have to worry about a timeout continuing to run.

I’m raging at this thread right now. Rammy took a cruddy ladder script I wrote as a quick example, added a setlevel2 and posted it.
Rework the entire script from scratch so it’s actually all your own work please.

Also,
I like hosler’s script. There’s nothing wrong with it Codr.

yesss. that’s all ive ever wanted from tricxta.

I was working with the base and asked for your advice and you gave me the example.
I couldn’t do better than what you did so I just filled in the blanks and strapped the setlevel2 to it.
I posted the script here for some more advice. If it bothers you, just close the thread/delete my post, I didn’t mean to offend you.

I would do something like this:

if (playerenters || timeout) { timereverywhere; timeout = 0.15; dontblock; drawunderplayer; setimg ropestairs.png; //Check if player's X-position is where the ladder is if (playerx == (x-0.5)) { //Check the Y-position where the ladder is. //In this case the ladder is 9 tiles long. if (playery in |y,(y+9)|) { playerdir = 0; playery -= (playery-this.oldplayery) / 3; timeout = 0.05; setani climb,; } //Check if the player is at the top of the ladder, //and if so warp the player. if(playery <= (y+0.5)) { setlevel2 cadavre.nw,32,32; } } this.oldplayery = playery; }

that script is so pretty i could masturbate to it.