global script slot2{
void run(){
//Barrier stuff
// Initialize variables used to listen on screen changes
int curscreen = -1;
//Hole/Lava stuff
//Initialize variables used to store Link's strating position on Screen Init.
int olddmap = Game->GetCurDMap();
int oldscreen = Game->GetCurDMapScreen();
int startx = Link->X;
int starty = Link->Y;
int startdir = Link->Dir;
//Clear global variables used by Bottomless pits.
Falling = 0;
Warping = false;
//Bottle Stuff
RefreshBottles();
//Setup variables for ice combos.
Setup_IceCombos();
//This initializes Ghost
StartGhostZH();
while(true){
ScrollFix(); //This said to keep at the top of the while loop, but I'm not sure what it is
if (Game->GetCurScreen() != curscreen) { //Barrier script
curscreen = Game->GetCurScreen();
Barriers_NewScreen();
}
EmptyBottleGlobal(); //Bottle stuff
UpdateGhostZH1(); //Important ghost stuff
Waitdraw(); //This is the magic half way point. Stuff above this is done BEFORE drawing, stuff below this AFTER drawing
UpdateGhostZH2(); //More important ghost stuff
BombsScreenShake(); //Bomb Screen Shake script
if(Link->Action != LA_SCROLLING) //Start of Hole/Lava stuff
{
Update_HoleLava(startx, starty, olddmap, oldscreen, startdir);
if(Link->Z==0 && !Falling && (oldscreen != Game->GetCurDMapScreen() || olddmap != Game->GetCurDMap()))
{
olddmap = Game->GetCurDMap();
oldscreen = Game->GetCurDMapScreen();
startx = Link->X;
starty = Link->Y;
startdir = Link->Dir;
}
} //End of Hole/Lava stuff
Update_IceCombos(oldscreen); //Ice combo stuff
oldscreen = Game->GetCurScreen(); //This too
Waitframe();
}
}
}
(Not sure why Pure's messing with the formatting of that... but anyways)
Here you go. Use this instead of any other script called global in your script file.
If you want to understand what's happening, I've tried to annotate this decently. The gist of it, you can only have one global script running, so you combine all of them together. Most global scripts come in functions, which you add to the global in the right spot. For example, let's say you want to add a new global that looks like this.
void ReallyCoolGlobalScript(){ //Put this before the waitdraw in your global
//Scary code goes here
}
All you would need to do is add this line:
ReallyCoolGlobalScript();
Somewhere above the "Waitdraw();" line in the global script, like how all the other functions have been added there.