As my game grows in size, and I add more and more scripts to it, I'm wondering if there is a golden rule for arranging the scripts in a specific order. Obviously sometimes the creator of the scripts (e.g. Yanfly, Victor) specifizes an order for their own scripts, but when I use a lot of different scripts together, is there a recommended order for them? For example scripts which change the UI first, then the battle scripts then graphic scripts or something. 🙂
Optimal script order?
RGSSx Script SupportAlways put the Core/Base (or however they are named) scripts which are required for other scripts to run at the top.
Aside from that, if you don't know scripting well, just try to keep the scripts which change the same or similar aspects of the game close to each other.
Like scripts dealing with menus, skills, items, events, and so on. Categorize them.
This is not bulletproof, of course, but if you encounter some problems, at least your scripts are organized.
I generally advise against categorizing scripts by authors, like putting all Yanfly scripts at the top, than all Victor scripts below, and so on.
That WILL get you into errors sooner than later, mostly because many Core scripts (sadly) use overwrites of the same methods.
If you know scripting (or if you won't mind searching for the methods yourself even without knowing what they are for), you can always search for overwrites and aliases in scripts, which will quickly give away (in most cases) the problematic ones. This assumes that you enter your scripts one by one, and not a bunch at once.
If you do it one by one, and test your game after each of them, and you encounter an error, you can just search for all the methods from the latest script you added in the other scripts you are using (with CTRL+SHIFT+F). If you see that there are more than one script using the same methods, check which one is an overwrite and which one is an alias. Overwrites always go above aliases for maximum compatibility. If both of them are overwrites, you must patch one of them, and put the patched one below the non-patched one (patching here basically means merging the separate things found in the method from the two scripts).
Even following what I wrote, you won't have a 100% sure order for your scripts. There are just too many scripts out there to not bump into some issues when you combine them.
Aside from that, if you don't know scripting well, just try to keep the scripts which change the same or similar aspects of the game close to each other.
Like scripts dealing with menus, skills, items, events, and so on. Categorize them.
This is not bulletproof, of course, but if you encounter some problems, at least your scripts are organized.
I generally advise against categorizing scripts by authors, like putting all Yanfly scripts at the top, than all Victor scripts below, and so on.
That WILL get you into errors sooner than later, mostly because many Core scripts (sadly) use overwrites of the same methods.
If you know scripting (or if you won't mind searching for the methods yourself even without knowing what they are for), you can always search for overwrites and aliases in scripts, which will quickly give away (in most cases) the problematic ones. This assumes that you enter your scripts one by one, and not a bunch at once.
If you do it one by one, and test your game after each of them, and you encounter an error, you can just search for all the methods from the latest script you added in the other scripts you are using (with CTRL+SHIFT+F). If you see that there are more than one script using the same methods, check which one is an overwrite and which one is an alias. Overwrites always go above aliases for maximum compatibility. If both of them are overwrites, you must patch one of them, and put the patched one below the non-patched one (patching here basically means merging the separate things found in the method from the two scripts).
Even following what I wrote, you won't have a 100% sure order for your scripts. There are just too many scripts out there to not bump into some issues when you combine them.
Original thread: https://forums.rpgmakerweb.com/threads/optimal-script-order.56668/