Skip to content
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

Idea: Section for userdefined values #5

Open
BergenSoft opened this issue Nov 29, 2020 · 0 comments
Open

Idea: Section for userdefined values #5

BergenSoft opened this issue Nov 29, 2020 · 0 comments

Comments

@BergenSoft
Copy link
Contributor

I have an idea which could be a great feature regarding the update process.

There should be a specific section in code, which is recognizable by ScriptDude, that contains only user specific values such als colors, translations, sizes, etc.
Whatever a developer will allow the user to change.

Right now an update would reset this value and the user has to change the colors again, or he will use the defaults.
This mechanism could work the follow:

The developer mark the code with the userspecific values for example like this:

// <ScriptDude_UserSettings>
const userSettings = {
  color1: "#FF0000",
  color2: "#00FF00",
  otherValue: 99
};
// </ScriptDude_UserSettings>

If the user change this values the updater could find this section and use eval(...) to get the result of the settings.
In the new code the updater makes the same.
The the two results has to be merged.
So the updater goes through all new settings and take a look if there was already a value in the original settings. If so the updater overrides the original values.
If all values were parsed the updater would change this section in the new code.
The hash calculation should be done with the original code from the owner, of course.

Of course there will be some limitations.
To use eval for only this one block, it is only allowed to use fix values. All function calls like Color.dynamic(..., ...) would be replaced by the corresponding value.

Of course the script developer has to follow this rules to support this user settings.

What do you think about this idea? Any improvements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant