-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
User configs #6720
Draft
Moderocky
wants to merge
36
commits into
SkriptLang:feature/script-reflection
Choose a base branch
from
Moderocky:user-configs
base: feature/script-reflection
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
User configs #6720
Moderocky
wants to merge
36
commits into
SkriptLang:feature/script-reflection
from
Moderocky:user-configs
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Patrick Miller <apickledwalrus@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
User-provided config files.
I was inspired by a conversation with Walrus yesterday around the lack of config stuff in Skript when they're normally such a big part of setting up a server.
We talked a lot about safety (I suggested registration, he suggested storing them in a
/configs/
directory) and this was the basic layout I came up with.Additions
This adds:
- Config registration structure
- Config get expression
- Changers for nodes
- Config reloading & saving via
EffScriptFile
A script-maker can register their own config file within a script. They are then able to read (and write) this config, in order to take input from a user in a more sanitary way than in-script options.
This also means users don't have to download and learn an unsafe file addon in order to make a config file.
It's primarily aimed at people publishing their resources, but it's also potentially a better alternative to the suggestion in historic issue #2028, since it allows common values to be collated in one safe place and shared between scripts.
There is a heavy focus on resource safety.
Syntax
What does this actually do?
It allows users to register a config file used by their script.
This file is linked to the script: they are loaded, reloaded and discarded together.
A config can be registered by multiple scripts.
Config values can be edited via the node tree.
Other Notes
I considered opening this up to other
.sk
files, since it wouldn't be a huge stretch to allow users to read and write general data files in the same way.That said, I was concerned about not being able to manage the opening/closing of unknown files safely and decided that was better left to an addon or a future project.
For anybody wishing to implement that themselves, you'd just need to return a
Config
or even aNode
from some expression.This is part of a series of linked stages around config and script management.
Related Issues: requires #6718, requires #6702, requires #6719, fixes #2028