Scripts organization

Started by Blizzard, August 21, 2011, 03:34:52 am

Previous topic - Next topic

Blizzard

August 21, 2011, 03:34:52 am Last Edit: August 21, 2011, 03:38:02 am by Blizzard
Where are we going to put the scripts? I suggest that we make a folder called Data/Scripts and put all scripts in there. The scripts will be simply .rb files and the filename will be their order number in the script editor plus a dot and the script name. e.g.

0.Game_Actor.rb
1.Game_Party.rb
2.Game_Switches.rb

We can easily put all scripts in a file called Scripts.arc when we compile it all and put it into the MsgPack format.
Files not matching this pattern will be ignored when loading the scripts. These files also won't be put into Scripts.arc.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Memor-X

will the order number also affect the load order, as we all know with RGSS, some scripts need to be above or bellow other script in order to make them work properly

also, would there be a main.rb and what would happen if you had like 0.Game_Actor.rb and 0.Game_Party.rb, would it then go in alphabetical order

ForeverZer0

This is for development only. 
The scripts will be packaged together in a single file for the release version.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

August 22, 2011, 02:15:14 am #3 Last Edit: August 22, 2011, 02:17:20 am by Blizzard
That's what the numbers at the beginning are for. We can't leave just the names as there would be no way to know in which order to load the scripts except if we used an external file. I want to avoid such a file, because the deletion of that file will mess up your script order. So we are using those numbers at the beginning of the filenames to determine which order the scripts are in.

The scenario with 0.Game_Actor.rb and 0.Game_Party.rb will never happen if you use the editor (and should never happen because it is actually an invalid order). But if you edit the scripts manually, you can make this happen. In this case we have to use the alphabetical order so the editor doesn't crash.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

you could also stick a comment in the first line of each script and then make some simple code to read the first line of each file and determine the order.  It's a bit slower, but since it is a one time process the tradeoff for filename cleanliness could be worth it.

Blizzard

Not really. Deleting a script or changing order would be too messy.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

PhoenixFire

Quote from: Blizzard on August 21, 2011, 03:34:52 am
...make a folder called Data/Scripts and put all scripts in there...the filename will be their order number in the script editor plus a dot and the script name...we can easily put all scripts in a file called Scripts.arc when we compile it all and put it into the MsgPack format...files not matching this pattern will be ignored when loading the scripts. These files also won't be put into Scripts.arc.


That.. I think it's a very good idea.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?