[Feature request] - Save script folder with multiple scripts as module

Started by Snarky, Thu 02/02/2023 11:12:22

Previous topic - Next topic

Snarky

As a script module writer, some modules can get very complex, and it would sometimes be useful to break them up into separate scripts. This would help keep individual files simpler, but also add flexibility for users about what functionality they need and what they don't, and allow the creation of "libraries" to provide features used within multiple script modules, without requiring code duplication.

For example, for the SpeechBubble module, it would be useful to have the code for text formatting/rendering and for formatting GUIs with outlines, corners and backgrounds as separate pieces of functionality in their own scripts, as well as the code that replicates AGS's speech blocking logic (and other missing Wait() functions).

Of course, you can do this already, but it means that there are dependencies between the scripts, and there is no good way to distribute them all together.

Similarly, someone might create a script module that uses e.g. Tween, or some other pre-existing module, but then they have to explain to users that they need the other module, and that it has to be placed higher in the hierarchy, etc.

I think a good way to solve this problem would be if it were possible to save and distribute the module as a (sorted) script folder. When imported, it would create the folder in the script hierarchy. (And to forestall one objection: it would be easy as a module author to use #ifdefs to avoid a case where the same script is imported twice in two folders, e.g. a bundled copy of Tween into a project that already has it.)

SMF spam blocked by CleanTalk