Community

AGI Programming => Mega Tokyo AGI Archive => Topic started by: Biosware on January 17, 2004, 02:32:22 PM

Title: If cel...?
Post by: Biosware on January 17, 2004, 02:32:22 PM
Ok, here's the deal: Me and my friend are currently writing a simple AGI game (both complete newbies with it) - and got stuck in the second room :D It's supposed to include a fridge which you could open and take the food inside. So how do we make sure the program knows when the food is taken? Is there an "if cel"-command or something to do this with, or must we use flags?

Thanks for taking time to think about something this stupid... :D
Title: Re:If cel...?
Post by: Kon-Tiki on January 17, 2004, 05:54:19 PM
There's no if-cell command, but there're two ways of doing what you want.
The easiest and most secure way is by setting a flag. This way, when the object is gone by using it, it won't be in the fridge again.

The other way is by using the if (has(objectname)) {-command. This checks wether the player has an object in his inventory. Off course, if he lost it later on it the game, it'll be back there.
Title: Re:If cel...?
Post by: Rich on January 17, 2004, 07:39:51 PM
Even better than that. Set the object to being in that room when you create it. Then do a if(obj.in.room()) command to see whether it can be gotten or whether a cel should be drawn for it.