I've played a lot of ZZT and am trying to make my own game. It's going to involve lots of item-Flags, but I've come up against a snag right from the gate.
There's a door which is supposed to check for a flag (RxK1), which stands for a keycard. If the flag's set, then the door is supposed to open. If not, the door tells him to go find the damn card.
For some reason, the program works backwards. When the flag isn't set, the door opens. When it is set, the door tells you to find the keycard. This confuses me to no end.. I can't seem to figure out why it's working backwards. I've even looked at other programs that use similar situations, but I don't see why mine works the other way around.
#cycle 1
#end
:touch
#if not RxL1 then nocard
#lock
(text about swiping the card)
(movement and #char stuff)
#unlock
#end
:nocard
(text about needing to get the damn card)
#end
Isn't it a total letdown when you're wiping your butt and the toilet paper stops but your hand doesn't?
but it still does the same. When the flag is NOT set, the door opens, but when the flag IS set, the door stays shut. I don't have more than nine flags 'cus this is the starting map.. this is what frustrates me so much. I've got all this game waiting to be made and I'm stuck at the very beginning.
Thank you for the help, though.
Isn't it a total letdown when you're wiping your butt and the toilet paper stops but your hand doesn't?
I tested your code and got rid of stuff you didn't need, it seemed to work fine, I used another object to set and clear the flag. So I dunno what your doing, maybe you misnamed the flag in another object.
a 2nd # isn't needed in an if statement if you're just calling a label and not issuing a command. Also flags are case insensitive, so RxL1 is the same as rxl1.
I was looking through some of my old code today and I noticed that I used a alot of #lock and #unlock and I don't remember why. They were pretty much stand-alone objects that didn't really have any commands going to or coming from other objects. I remember I had to use the commands to get the things to work like I wanted them to. Anyone know why?
prevent an errant :touch message perhaps? It's good practice to do that though. It's not a problem unless you really get desperate for the extra memory.
I added #lock/#unlock commands because the door is one of those nifty "swinging" animated doors, and I didn't want a mis-touch to cause it to swing further out into the hallway and break off the wall.
And it turns out that I had screwed up my coding in a totally different object. I'd made one designed to Set or Clear the flag needed for that door so I could test wether the door worked right or not. But I'd forgotten to put an #end before the :touch part. So every time I started the game, it would automatically Set the RxL1 flag.
Thanks for your help, everyone. =D
Isn't it a total letdown when you're wiping your butt and the toilet paper stops but your hand doesn't?