Jump to content

Photo

Multiple Global Scripts, How Do?


  • Please log in to reply
3 replies to this topic

#1 MarinaraSauce

MarinaraSauce

    Magus

  • Members
  • Real Name:Grant
  • Location:New York

Posted 29 September 2016 - 03:22 PM

I'm sure a thread like this pops up once every month or so, but I'm about as good at scripting as a chicken is at constructing a NASA space shuttle.

 

I would like to use both Mero's bottomless pits/lava script as well as the ice combo script, but I'm not totally clear on how to use multiple global scripts at the same time. I've tried to do what was being explained in this thread, but I must have done something wrong because it's not working. I've created two additional script files and place one of the scripts in each. Then I put import statements at the top of my master script file for each of them, but it's giving me an error regarding one of them (oddly enough the second one set to import, which would seem to indicate that the first one was imported correctly) saying "Failure to parse imported file". Is there something I'm missing?



#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 29 September 2016 - 05:12 PM

Global scripts are a bit tougher to combine, because you can only have one global script in your quest. I admit when I answered that thread, I missed the word "global" and thought the question was about FFC/Item scripts.

 

So, each global script will look something like this:

// IMPORTS
import "std.zh"
 
// CONSTANTS AND GLOBALS
const int SOMETHING = 1;
 
int globalVar = 2;
 
global script active {
    void run() {
        // PRE-LOOP
        int x  = 3;
       
        while(true) {
            // LOOP
            doAThing();
           
            // WAITFRAME (need this once at the bottom of the loop)
            Waitframe();
        }
    }
}
 
// OTHER FUNCTIONS
void doAThing() {
}

 

So what you need to do is this:

1) Make a new global script file with all of the sections I marked IN ALL CAPS (but without the made-up variables and function call).

2) In each of your global scripts, identify those sections (if they exist), and copy them into the matching section in your master global script.

 

So, at the top, after all your imports, you'll have your constants from pits/lava, your constants from ice combos; your pre-loop from pits/lava then ice combos, your loop from pits/lava and ice combos, a single Waitframe(), and then all of their functions at the bottom of the file.

 

Does that make sense?


  • MarinaraSauce likes this

#3 MarinaraSauce

MarinaraSauce

    Magus

  • Members
  • Real Name:Grant
  • Location:New York

Posted 29 September 2016 - 05:45 PM

Yeah that makes sense. I'll see if I can get it to work. Thanks



#4 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 29 September 2016 - 08:51 PM

Don't forget Poland Waitdraw().

http://www.purezc.ne...=70055&p=996816

I combined ice combos and pits (and a couple other things) in that thread, and also made an attempt to explain how global scripts are structured.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users