Flags on and off
Deesjebeesje
12 Jun 2011, 17:10Hey I'm totally new to this forum (and program) and I have a real newbie question which I couldn't find in the tutorial. If I type 'switch on oven' while the oven is already on, it still says: you switch on the oven. How can I change this into p.e.: the oven is already on? And how can I set the oven off when I start the game?
I'm sorry if this question is already answered, but I couldn't find it and I hope you can help me with some sort of step by step explanation.
I'm sorry if this question is already answered, but I couldn't find it and I hope you can help me with some sort of step by step explanation.

Jack_Cade
13 Jun 2011, 00:01In the 'switch on oven' command, set a condition, so that if the 'oven is on' flag is on, you get a different message. So you end up with something like:
If: 'oven is on' flag is on, print text 'The oven is already on'
Else: Change 'oven is on' flag to on.
Sorry - I'm a total newbie like you, but it occurred to me I might be able to answer this! Apologies if it's a crap explanation.
If: 'oven is on' flag is on, print text 'The oven is already on'
Else: Change 'oven is on' flag to on.
Sorry - I'm a total newbie like you, but it occurred to me I might be able to answer this! Apologies if it's a crap explanation.
Deesjebeesje
13 Jun 2011, 09:48Thanx a lot!! It works perfectly!!
For my next question: I want to make a cabinet which I can open and close which reveals a key when you open it and hides it when the cabinet is closed. When I try the command 'look in cabinet' it says: it's (the cabinet) not in here. What do I have to do to make it work? Btw: I already tried the hide and reveal commands and the key is for making the door to the exit open.
For my next question: I want to make a cabinet which I can open and close which reveals a key when you open it and hides it when the cabinet is closed. When I try the command 'look in cabinet' it says: it's (the cabinet) not in here. What do I have to do to make it work? Btw: I already tried the hide and reveal commands and the key is for making the door to the exit open.
Deesjebeesje
13 Jun 2011, 20:39Okay, I think I found out how that one worked, but when I put the key somewhere else and open the cabinet again, it still says: you open the cabinet: you see a key. How can I fix that?
RedTulip
14 Jun 2011, 03:38You did make sure that the cabinet is a container, right? Anyway, in the key object, click the inventory tab.
Choose to run a script instead when someone takes the key. Make sure to make a conditional script checking whether the key has already been taken.
On the script that runs when it is not taken and is being taken, make sure to change the 'parent' property of the key object to nothing.
If you don't understand, I'd explain it better, but I'm using my iPod.
Choose to run a script instead when someone takes the key. Make sure to make a conditional script checking whether the key has already been taken.
On the script that runs when it is not taken and is being taken, make sure to change the 'parent' property of the key object to nothing.
If you don't understand, I'd explain it better, but I'm using my iPod.
Deesjebeesje
14 Jun 2011, 07:51I understand that, but what do I do about the cabinet? It still says: you see a key (when I open it).
I'm sorry if I'm making things difficult, but I have a difficulties with understanding things and with understandable reading things. That's why I need things to be explained step by step.
I'm sorry if I'm making things difficult, but I have a difficulties with understanding things and with understandable reading things. That's why I need things to be explained step by step.
RedTulip
14 Jun 2011, 11:32Ok, so, click the cabinet object...
After that, click the 'Container' tab. Make sure 'Container' is chosen.
Make sure the action of the verb 'list' is displayed.
For the key object, make sure the Parent is the cabinet object.
Click the Inventory tab.
Choose 'Run a script when the player types "take...":'
Add a conditional script. Add a condition.
Select the 'The player has an object' condition. Type 'key' under the 'Object:' text.
Click OK.
As the 'Then' script, print a message saying "You already have that.".
Click Ok.
Edit the 'Else' script.
Add a script that prints a message saying 'Taken' or something that tells the player he/she had taken the key.
Add another script that would modify a property.
TO do that, collapse the 'Modify' group. Choose the property script.
Type 'key' as the Object or Room name.
As the property, type 'parent='. That means you would change the parent of the key to nothing.
Add one last script. Collapse the Objects group and choose 'Give an object to the player'. Type 'key' or choose the key object.
Click OK.
Click OK.
Hope it works
After that, click the 'Container' tab. Make sure 'Container' is chosen.
Make sure the action of the verb 'list' is displayed.
For the key object, make sure the Parent is the cabinet object.
Click the Inventory tab.
Choose 'Run a script when the player types "take...":'
Add a conditional script. Add a condition.
Select the 'The player has an object' condition. Type 'key' under the 'Object:' text.
Click OK.
As the 'Then' script, print a message saying "You already have that.".
Click Ok.
Edit the 'Else' script.
Add a script that prints a message saying 'Taken' or something that tells the player he/she had taken the key.
Add another script that would modify a property.
TO do that, collapse the 'Modify' group. Choose the property script.
Type 'key' as the Object or Room name.
As the property, type 'parent='. That means you would change the parent of the key to nothing.
Add one last script. Collapse the Objects group and choose 'Give an object to the player'. Type 'key' or choose the key object.
Click OK.
Click OK.
Hope it works

Deesjebeesje
14 Jun 2011, 12:55That's about the key, and what about the cabinet? If I open it, it now says: the cabinet is empty 

Deesjebeesje
15 Jun 2011, 15:34Anyone?
RedTulip
16 Jun 2011, 05:32Shouldn't it say that? Wait, you did make the parent of the key the cabinet, right?
And if the player does take the key, it should say that.
And if the player does take the key, it should say that.
Deesjebeesje
16 Jun 2011, 09:49I meant: when I open the cabinet it doesn't show the key... I know it has something to do with the 'list' verb, but what do I put there?
RedTulip
16 Jun 2011, 16:32You could type 'You see:'
Deesjebeesje
16 Jun 2011, 17:36Nope...doesn't work