'if not flag on <...>' = 'if flag off <...>' ?

Farvardin
28 Aug 2003, 18:42
Sorry to post again, it seems I'm writing much here at the moment...
It's the second time I have pb with a if ... statement, but this time it seems it's not my fault.

I was coding some replies from a NPC according to the context. When something happens I turn a flag on.
At the beginning of my game I declare all the flag I will need and turn them off.

But when I made my replies, this code didn't work :

speak {
if flag off <thorn_seen> then {
msg <"We have to find some plants now", he answers.>
}
if flag on <thorn_seen> and flag off <livolas_poisonned> then {
msg <"Let's find something to free this noble lady", he answers.>
if flag on <livolas_poisonned> then {
msg <"I hope it's not too dangerous">
}
}



I tested it and acted so some flag could be turned on. It was like "flag off" wasn't recognised at all. Btw the property viewer notifies only about flags on, and doesn't tell about flags off.

then I remplaced all "flag off" to "not flag on", and it works correctly now.

Alex
28 Aug 2003, 20:34
You don't use "if flag on" - the condition is called "flag", so the possibilities are:

if flag <flag name>

and

if not flag <flag name>

This is why it appears to you as though "flag on" is working (as Quest just reads that as "flag"), but not "flag off" (as Quest is also reading that as "flag", so if you write "if flag off <something>" it will be TRUE when the flag is OFF).

The reason you can't see flags which are off is that they don't really exist when they're turned off. They are shortcuts to boolean (on/off) properties of the "game" object, and boolean properties are either present (on) or not present (off). So when you turn a flag off, you remove it, so you won't see it in the Property Viewer.

Farvardin
28 Aug 2003, 21:26
ok...

I think I can blush again... :oops: :oops: :oops:

I used so far " if flag on <...>" so I didn't noticed it wasn't correct because it worked.