How Does EventScript Work?

NOTE: PLEASE IGNORE THE CODE FROM LINES 4-9. I USED THE CODE THAT CAME WITH THE SCRIPT AS A REFERENCE.

This might sound like a stupid question, but it isn’t. So the point is is that does EventScript wait for other lines of scripts, or does it just go on without waiting. I will show you an example.

In the picture, you can see that there is a wait(5) and wait(10) and the line(s) of script below it. The lines of script below the wait functions are the ones that make the water (lava) rise and the one that closes a certain door over time. Since the lava script goes first, will EventScript wait for the script to finish and then execute the 2nd wait function, or will it just execute the moveWater function and then immediately execute the wait function so it can move the door parts. It would be most appreciated if you can respond to this question.

Thanks,
Azer60

works just like the eventstring

wait(x) delays the amount of time before moving onto the next line, x being how long in seconds. Without it, the game just moves onto the next line instantly and as fast as possible. It will first wait 0.1 seconds before turning to lava, then wait 5 seconds and making that lava rise. Ten seconds later, it will move the doors in the two seperate directions.

moveWater does not yield.

what is "yielding"?

an action of preventing other script beyond the yielding line from working, a good example would be the wait(), as you can see, it wait as long as the determined seconds and prevent any other lines beyond it from working until its done waiting. there are plenty more stuffs that can yield but wait() is more (arguably) easier to explain.

1 Like

@ExtremeMaster999, so you’re saying that the code will wait until the lava has moved, and then the door parts will be in motion (I am big dumb in eventscript).

Actually, the code moves on, even when the lava is moving. You have to put a wait(x) in order to space out different events. Scripting is really confusing, but once you figure out the weird parts then it’s easy to understand.

You are the man

Glad I can help