PlayerGoesIntoBedroom is a truth state that varies. PlayerGoesIntoBedroom is false.
When the player is in Bedroom:
now PlayerGoesIntoBedroom is true.
How to phrase this correctly in order to make PlayerGoesIntoBedroom true at the first time the player goes into the Bedroom and keep it permanently true (even if the player exits the Bedroom).
Living Room is a room.
Bedroom is east of Living Room.
After going to Bedroom:
now PlayerGoesIntoBedroom is true;
continue the action.
It will always be true until you change it to false with another rule. âContinue the actionâ will make sure that a room description is printed, as the After rule will short-circuit the âlookingâ action otherwise.
Just so you know, every room has a visited/unvisited property. By default a room is unvisited. In the Standard Rules, the room becomes visited when the room description is displayed (in a Carry out looking rule).
At the end of the action, really. (Visited is set before âevery turnâ rules run, for example.)
If you want to print a message when visiting a room, then you write an âAfter going to âŠâ rule, like Epicifer said. (Be sure to end it with âcontinue the actionâ, unless you want to completely replace the room description.)
I attempted an example for this. Your mileage may vary
The scene is composed of two rooms, one that always seems new to the player and one where the description varies based on if the player has visited it or not. I also included a truth state variable that is set when the player visits the âDejaVuâ room.
PlayerGoesIntoDejaVu is a truth state that varies. PlayerGoesIntoDejaVu is false.
Always New is a room. The description of Always New is "This room seems new to you no matter how often you visit it. Its black walls and black floor never seeming to form a long term memory in your mind.".
DejaVu is a room. The description of DejaVu is "[if DejaVu is unvisited]The is a simple room with white walls and a black and red checkered floor.[otherwise]Strangely, it feels as if you have been here before. The white walls and checkered floor spark old memories of a time long past.[end if]".
DejaVu is north of Always New.
Before going to DejaVu:
say "[if PlayerGoesIntoDejaVu is false] You make a note in your journal about this interesting room.[Otherwise]You check your journal and see that you made a note of visiting this place in the past.[end if]";
Now PlayerGoesIntoDejaVu is true;
Continue the action.
Here is what the game play looks like:
Always New
This room seems new to you no matter how often you visit it.
Its black walls and black floor never seeming to form a long
term memory in your mind.
>n
You make a note in your journal about this interesting room.
DejaVu
The is a simple room with white walls and a black and red
checkered floor.
>s
Always New
This room seems new to you no matter how often you visit it.
Its black walls and black floor never seeming to form a long
term memory in your mind.
>n
You check your journal and see that you made a note of
visiting this place in the past.
DejaVu
Strangely, it feels as if you have been here before.
The white walls and checkered floor spark old memories
of a time long past.
@lacerda â were you already aware of Inform 7âs built-in visited / unvisited and the âgoing intoâ counts? If so, what specifically are you trying to do that you canât do with the visited built-in?
There are lots of examples of using visited / unvisited if you search the documentation â for example, the recipe âSlightly Wrongâ:
on a cognate point, Iâm toying/fooling around around PC (not playerâs) knowledge of prior rooms visited. For a banal example, if the PC has already seen room X, whose contain item A and now enter room Y whose contain item B, (and visa-versa) and having entered both room, said PC notices a connection between the two items.
(Iâm not sure if I have explained decently the conceptâŠ)
Cool idea. Epistemology will let you establish if the player is familiar with the items. You can finagle that into representing knowledge of their position. You could then add an after rule to item description to conditionally show a message.
Epistemology provides two properties for things: seen/unseen, familiar/unfamiliar. Unfortunately, they are both set when the thing is mentioned in a description. I always thought âseenâ should be, you know, when youâve see the thing; and âfamiliarâ should be when youâve examined it. I use the following to achieve that:
[We don't want items to be automatically familiar just because they're seen.]
Carry out looking (this is the revised mark items as seen when looking rule):
unless in darkness:
now every backdrop in the location is seen;
repeat with item running through things that are enclosed by the location:
if the item is not enclosed by an opaque closed container:
now the item is seen.
The revised mark items as seen when looking rule is listed instead of the mark items as seen when looking rule in the carry out looking rules.
[We don't want items in containers to be automatically familiar just because they're seen.]
Carry out opening a container (this is the revised mark items as seen on opening a container rule):
repeat with item running through things that are enclosed by the noun:
if the item is unseen and the item is visible:
now the item is seen.
The revised mark items as seen on opening a container rule is listed instead of the mark items as seen on opening a container rule in the carry out opening rules.