• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Change execution order of scripts when game starts?

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?
 

Zephni

Member
I know this is a relatively old post, but this is what comes up when you Google the question, and I think it's a fair one: How do I determine / change the execution order of GMS2 stand alone scripts?
 
Top