if ( #Object_Check_String# = screw ) then {
if ( #quest.currentroom# = Southeast Room ) then if here <South_Screw_Bottom> or here <South_Screw_Top> or here <South_Screws> or got <South_Screw_Bottom> or got <South_Screw_Top> or got <South_Screws> then msg <|nBrassish.|n>
if ( #quest.currentroom# <> Southeast Room ) then if got <South_Screw_Bottom> or got <South_Screw_Top> or got <South_Screws> then msg <|nBrassish and tiny.|n> }
if ( #Object_Check_String# = screw ) then {
flag off <got screw>
if here <South_Screw_Bottom> then flag on <got screw>
if here <South_Screw_Top> then flag on <got screw>
if here <South_Screws> then flag on <got screw>
if got <South_Screw_Bottom> then flag on <got screw>
if got <South_Screw_Top> then flag on <got screw>
if got <South_Screws> then flag on <got screw>
if ( #quest.currentroom# = Southeast Room ) then {
if flag <got screw> then msg <|nBrassish.|n>
}
if ( #quest.currentroom# <> Southeast Room ) then {
if flag <got screw> then msg <|nBrassish and tiny.|n>
}
}
I think I've got the explanation.
First, how Quest apparently handles if statements:
The condition:
Treat everything following the "if" as a condition.
Then, loop through all the words in the line.
- If the word is "and", treat everything following it as a condition.
Loop through the words in the line again, starting after the last "and". (If there were none, start after the "if").
- If the word is "or", treat everything following it as a condition.
Associate left to right.
If it passed the condition, run whatever occurred after the first "then".
So the statement
if A then if B or C then ...
is really handled as:
Condition (A or C)
Then clause: if B or C then ...
And is ultimately:
if (A or C) then { if (B or C) then { ... } }
if ( #Object_Check_String# = screw ) then {
if ( #quest.currentroom# = Southeast Room ) then if here <South_Screw_Bottom> or here <South_Screw_Top> or here <South_Screws> or got <South_Screw_Bottom> or got <South_Screw_Top> or got <South_Screws> then msg <|nBrassish.|n>
if ( #quest.currentroom# <> Southeast Room ) then if got <South_Screw_Bottom> or got <South_Screw_Top> or got <South_Screws> then msg <|nBrassish and tiny.|n> }
if ( #Object_Check_String# = screw ) then {
if ( #quest.currentroom# = Southeast Room ) then {
if here <South_Screw_Bottom> or here <South_Screw_Top> or here <South_Screws> or got <South_Screw_Bottom> or got <South_Screw_Top> or got <South_Screws> then msg <|nBrassish.|n>
}
if ( #quest.currentroom# <> Southeast Room ) then {
if got <South_Screw_Bottom> or got <South_Screw_Top> or got <South_Screws> then msg <|nBrassish and tiny.|n>
}
}
paul_one wrote:Freak;
So you're saying Quest scans the line twice (or more)? One for AND - then for OR?
Or do you mean, from the last conditional statement?
.. So the main problem is that it doesn't stop at a "then" keyword?
So the 'scanning' keeps going until an "and" or "or" is found, and adds the next condition/s to the parent list (hopefully with an appropriate 'and' 'or' logic)..
Once that's done, it validates the conditional/s and then steps into the parent's 'then' block, and begins the process again.
Of course, I'm guessing this can all be avoided with use of brackets to split up lines, etc.
If I'm at Fresh Mart, then if a banana is here or a zucchini is here, then I say "I can't wait to take them out of the store and eat them."
If I'm not at Fresh Mart, then if a banana is here or a zucchini is here, then I say "Yummy, I'm going to eat them now."