-
-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dependencies section to skripts #6564
Comments
This can some how be done with SecConditional
|
It works as a workaround, I use this myself. But if the skript you set in the condition is not loaded before your script, it is useless. But it becomes messy when there are a lot of scripts, or when you share resources on SkUnity, because everyone has its own way to organize its scripts. Setting dependencies could solve everything. |
This shouldn't be necessary. We have put a lot of effort into trying to make forward references safe (e.g. using functions from another script shouldn't be conditional on load order). I'm assuming you're requesting this because of an addon that doesn't allow this kind of reference. If there's something breaking this then it's probably better to fix that than to add some kind of work-around system. It's very hard to make script->script dependencies work in practice. In theory we just have to delay parsing it until last, but in practice that's not actually going to help. If I have two scripts declaring dependencies which do I attempt parsing first? What if they declare a dependency on each other? What if they ask for a script but there's more than one script with that name? What if a user downloads your script and renames it? Dependencies work (ish) with plugins because they're packaged and deployed in a non-editable resource format, so they can be very confident that things will be as they expect them to be. A script is a glorified text file that's designed to be edited, so there's absolutely no safety assurance. |
Suggestion
It would be so useful to be able to define a Skript as dependent on another so that it is ALWAYS loaded after its dependencies, no matter its position in the directory tree.
I know that by organizing the directory tree, one can define the order in which scripts are loaded, but it would be very, very useful for servers that use a lot of scripts, or for those who share their resources on SkUnity, etc. Because everyone manages their directory tree as they wish according to their needs, and I think we should be able to define a mandatory loading order in the configuration of Skript.
We could add a new section in the scripts, like "dependencies," which allows Skript to understand that this script must be put in a waiting list until the other scripts on which it depends are not loaded.
This could also be used with plugins, to load scripts after a plugin is loaded because there's a lot of issues when using externals API with skript-reflect (for example, ItemsAdder always loads after Skript which causes many issues).
This system could work in the following way:
An option should be added in config.sk to enable or disable this, such as 'enable-dependencies'. If this is disabled, the classic method of Skript would be retained, which would allow those who do not need this type of loading not to use it, as it could potentially be longer.
Why?
Useful for servers that manage many scripts, or for those who share their resources which depend on other resources.
Other
Example:
Agreement
The text was updated successfully, but these errors were encountered: