As most of you already aware, basic module / core script is typically a base for all of your scripts. Some of your script may requires your basic module, some doesnt.
This just a mere curiousity of me. For you fellow scripters who a fan of basic module and such. How do you make your own basic module? I mean, what do you gonna put inside the basic module? is it just basic function without breaking stuff / overwriting the default script? or it does change how default script works? How do you ensure if it has a high compatibility?
Let me give you a few example.
- Yanfly Core Engine is a core script that overwrites most of default scripts. It also add comma separate decimal. But it isn't required for all yanfly scripts. Since Yanfly Core engine only fixes bugs
- Victor's basic module overwrites / aliased most of default script as well. It helped most of his scripts work together in neat structures. I was once working with his script in someone's project. However it may generate some issues with someone's script if it doesn't have same workflow as victor's
- My own basic module only contains functions that not used until there's a script requires it. I overwrote / aliased a few of default script just for a few bugfixes. Not core / internal default script workflow.
How do you make your basic module / core script?
● ARCHIVED · READ-ONLY
-
-
The only script that I released so far that has a basic module would be my menu customization module script. The core basically has all the settings and the shared methods that the other "add-on" scripts would be using.
Ah wait, I also consider the main script of my skill level system as a core. It gives the basic functionality of skill leveling (basically just skill levels) while everything else would be done via add-ons (like skill exp upon usage etc) -
I wrote my core more so as a scripting tool. I added a few more methods to the window base and changed a few already exsisting ones. For example i rewrote draw_text to take font size and color as well as the original. I also added a veritical gauge too.
The way i decide if it needs to be added to my core is if i am using the same custom method in multiple scripts. It saves a lot of time to only write it once in a core, rather then trying to rewrite it 50 times. -
A core script thing is more for situations where you know you'll be making separate script add-ons in the future that affect similar things, like a project. If you're gonna make a set custom menus, you can easily use a core to function as the common changes within all the menus (background image/texture, window border, fonts, etc.), and then the add-on scripts for each specific menu. (menu selections/icons and items/skills/parameters/placements/etc.) The core script especially matters when, let's say you want this custom stuff to only apply for skill/item windows but not the equip or status windows.
-
If I actually need to overwrite things to make it more flexible so that I can write multiple scripts, I would create a core script, while attempting to maintain backwards compatibility by keeping the same interface.
Otherwise if it's only going to be used by one script, then I don't bother with a core script.
I don't require people to use the core script, even if it isn't needed. I don't see much need to add things that may break compatibility if they don't need it. -
If you find yourself resuing certain methods throughout several scripts, then it might be useful to take them out and put them in a helper script to save you from repeating code.