Erik Leppen
Member
Since 2.3, scripts are "packages of code", so to say, and they are now called when the game starts. This means that any code not wrapped in a function definition, is executed right away. This is very useful for setting up global stuff.
Now I have the problem that I have a "generic function collection" for my game that declares a global variable, and I have another script that is more specific, which uses that global variable to set up other things. (In my current case, the first file defines a vertex format, and the second file uses that to define vertex buffers.)
To keep things structured, I don't want to put the two in a single script. But I need the specific script to run after the generic script. Of course, I can put the script contents of the second script in a function and call the function in an event, but that would defeat the idea of this new global execution concept.
So, (how) can I change the order in which scripts are executed on game start?
Now I have the problem that I have a "generic function collection" for my game that declares a global variable, and I have another script that is more specific, which uses that global variable to set up other things. (In my current case, the first file defines a vertex format, and the second file uses that to define vertex buffers.)
To keep things structured, I don't want to put the two in a single script. But I need the specific script to run after the generic script. Of course, I can put the script contents of the second script in a function and call the function in an event, but that would defeat the idea of this new global execution concept.
So, (how) can I change the order in which scripts are executed on game start?