The way I usually try to approach parsing these is by setting out my chain and then adding parentheses in pairs. For your example, I’d jot them down and then work through adding the parentheses like this:
*if (A and B) or C or D or E
*if ((A) and (B)) or (C) or (D) or (E) (one pair and three stragglers)
*if ((A) and (B)) or ((C) or (D)) or (E) (two pairs, one straggler)
Step 4 There are a few ways this final step could go – I might reorder to make it clearer
*if (((C) or (D)) or (E)) or ((A) and (B)) This has all my ‘or’ parts together at the front to make it easier to keep track, and now I have two sets: set
(((C) or (D)) or (E)) and set
((A) and (B)): .
*if (((A) and (B)) or ((C) or (D))) or (E) This keeps the original order but still keeps my ‘and’ condition grouped together correctly.
That example looks a little mystifying with all the letters, but if the variable names are clear, the stat check’s logic can be easier to follow:
The guards dash towards you, spears raised.
#Yell, 'Halt in the name of Their Majesty, ruler of the known world!'
*if (((monarch > 60) and (monarchs_favour)) or ((commanding > 65) or (persuasion > 75))) or (burly > 80)
Astoundingly, they do.