Glad it’s handy.
Since you mention and statements, it’s worth noting that they’re a little bit trickier, because the order matters. Don’t know if this example will be helpful to anyone at all, but here’s a stab:
If everything is an or, then each variable is equally important in the outcome. Imagine a game with some true/false variables that describe how our companion Dex has developed over the course of the story so far:
Will you vote for Dex as leader of the party?
*if (axe_murderer or bigot) or led_previous_party_to_deaths
Your first impulse is to say OH HELL NO.
Because any of these “glaring massive flaw” variables would equally disqualify Dex if true, you link them using or, and you can shuffle those variables in any order you like:
*if (bigot or axe_murderer) or led_previous_party_to_deaths
*if (bigot or led_previous_party_to_deaths) or axe_murderer
*if (axe_murderer or led_previous_party_to_deaths) or bigot
all do the same thing. The only reason we’ve got parentheses in there is to help ChoiceScript follow what’s going on.
But maybe there’s an and involved. Sure, Dex led another party to their deaths last chapter, but it might have actually been someone else’s fault:
*set dex_fault false
So we only want the variable “led_previous_party_to_deaths” to come into play if “dex_fault” is true.
If we just add this and the way I described above for adding another or, though, it’ll cause problems:
*if ((bigot or axe_murderer) or led_previous_party_to_deaths) and dex_fault
will have us blithely voting for bigot Dex or axe-murderer Dex – as long as the deaths of the previous party weren’t Dex’s fault.
Instead, we need to structure our parentheses so that the two things linked by an and stay together as “one thing” logically – in this example, so “dex_fault” is a relevant qualifier if Dex got the party killed but not if Dex has become a bigot or murderous psychopath. Here are two different ways that should work, both in terms of the game logic and in terms of using parentheses to present ChoiceScript with no more than two things at a time:
*if (bigot or axe_murderer) or (led_previous_party_to_deaths and dex_fault)
*if ((led_previous_party_to_deaths and dex_fault) or bigot) or axe_murderer
If we then want add more ands (you mentioned 4 mixed and/ors, Sam), we just need to make sure we keep the logic straight and add things one at a time, popping brackets around each new set of things we want to keep together.
Say for example that one of the protagonist stats is Softheartedness, and if you have a score above 75, you’ll be inclined to overlook little things like bigotry and Dex’s earlier fatally bad track record. (If Dex has become an axe murderer, even a softy still draws the line).
So we want to take our previous “one thing”
(led_previous_party_to_deaths and dex_fault)
and link it using an or to Dex’s bigotry – because we’d be willing to overlook either of these things if we’re soft enough –
((led_previous_party_to_deaths and dex_fault) or bigot)
then take account of the softheartedness threshold
(((led_previous_party_to_deaths and dex_fault) or bigot) and (softhearted < 76))
and finally bring the axe murdering back in.
Vote for Dex?
*if (((led_previous_party_to_deaths and dex_fault) or bigot) and (softhearted < 76)) or axe_murderer
OH HELL NO.
Clear as mud?