flags - am I doing it wrong?
EagleWing
12 Sept 2004, 12:24In reply to my previous (swap) question Al said
The problem is my program doesn't seem to want to recognise my flag
This shows where and how I set it up (between end of game definition and before first room definition.)
This is where I try to use it. Whether I set the flag on or off I always get the result for "not flag<>"
What am I doing wrong please?
Frank
"I think all you need is a simple flag called (say) "rats_fed"... you can test this in code to describe the rats, and a similar test will decide whether your player should be able to get the goodies..."
The problem is my program doesn't seem to want to recognise my flag
define synonyms
end define
flag on <rats_fed>
define room <Outside the Tower>
This shows where and how I set it up (between end of game definition and before first room definition.)
description <You are in a cellar. It is rather dark - though light enough to see (and hear) that the room is full of rather vicious looking rats. |nThere are stairs going up to the ground floor.|n There also seems to be a door to the east.>
beforeturn override if not flag <rats_fed> then {
msg <The Rats won't let you pass>
create exit east <Damp Cellar;Damp Cellar>
else create exit east <Damp Cellar;Storeroom>
}
This is where I try to use it. Whether I set the flag on or off I always get the result for "not flag<>"
What am I doing wrong please?
Frank
Alex
12 Sept 2004, 13:46"flag on" is a script command, so you can't just leave it dangling anywhere or it will never get run. Especially if you leave it outside of any define blocks like that. If you want the flag to be set when the game starts, make the "flag on" command part of the game startscript.
EagleWing
12 Sept 2004, 16:53I'm sure there'll be more evidence of my status as a nubee before I finish this simple adventure but that one seems to be solved now!