I'm using Twine 2.1 with SugarCube 2.12.0.
I'm looking to see if there's a way to use the Settings UI to make a Setting that affect other Settings, so for instance:
Setting.addToggle("showdesc", {
label: Show Description,
default: true
}
Setting.addList("describe", {
label: Describe,
list: ["None", "Nature", "People", "All"],
default: "All"
}
Now, I want it so that if
showdesc is set to
false,
describe is disabled and/or automatically set to None as well. In this example, it would be pointless to set what to describe if the descriptions aren't going to be shown.
I'm thinking, a callback to .removeList("describe") in onInit/onChange for showdesc, but I'm pretty sure removeList() is just my imagination and it's not available in the Settings UI.
Is there a way to simulate that?
Comments
And now a question. Why have the showdesc toggle setting at all if you can set the describe setting to "None"? It just seems redundant.
For the question, I'd like to make it automatic. So, if the showDesc is set to False, I'd like describe to automatically change to None. However, if showDesc is not None, I'd like the user to be able to set the describe level to their preferences.
I can probably just check for settings.showDesc && settings.describe === "Nature" (or similar) every time, that's Plan B, I suppose.
To be clear, I can tell you what you want to know. The Setting API does not allow controls to be disabled/removed once they've been added, so that's a wash. As far as having one setting modify another, that is completely doable. It would be fairly easy to have the showDesc setting—or showdesc, either way case matters—set describe to "None" if it is toggled off by the player.
I'm not trying to be difficult, I'm simply trying to understand why you want to do what seems like a less than stellar idea on first blush. I like to keep footgun moments to a minimum if I can.
I realize I'm being a bit obscure here, it's a bit deliberate considering what I'm trying to control with these settings, so I'm describing it rather generic.
How about this for a better case:
I want it so that if useSounds is false, volBG is set to 0 (and preferable can't be changed). Otherwise, the Player is free to set volBG to any of the levels.
So, I suppose your best option here would either be to check both.
You already know how to do this, but I'm enumerating it here for completeness:
Check for everything everytime, it is. If that's the case, then I need to ask one other question, which I shall do in another post.