Rules (When)

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).

2 Likes

You can say something like–

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).

4 Likes

True. A room becomes ‘visited’ at the end of the turn in which you enter it.

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.)

2 Likes

I attempted an example for this. Your mileage may vary :slightly_smiling_face:

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.
1 Like

@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”:

http://inform7.com/book/RB_3_1.html#e234

and the advanced example, “Infiltration”:

http://inform7.com/book/WI_9_14.html#e199

1 Like

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
)

Best regards from Italy,
dott. Piergiorgio.

1 Like

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.

1 Like

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.

3 Likes