Using 'after' stops room names & descriptions

In my game I want users to see a message showing where they’ve just been. To do this I am using after. But when I do, it stops the name of the room and the description from showing! I have tried setting lookmode to verbose but it made no difference. How can I keep the room description & simply add another message underneath when the user moves to another room?

Here’s the relevant code (from PunyInform 3.2) and a screenshot of the problem in action.

Object SouthRoom "The Entrance"
	with description "An open doorway leads north.",
    after [;
		if (Hub has visited) {
			"^You could go back North to the Hub.";
		}
	],
        n_to Hub;

Thanks.

Use an after clause but don’t return true.

    after [;
		if (Hub has visited) {
			print "^You could go back North to the Hub.^";
		}
	],

EDIT-ADD: You probably want to specify Go: as the action case, or this message will appear after every action in the room. Unless PunyInform handles this differently? I’m thinking of my (classical) Inform 6/11 experience.

2 Likes

A bit like what Andrew says, but the problem is that you want this text to be printed:

  • Only when the player has just entered
  • After the room description

If you do this after the Go action, it’ll be printed before the room description. This is the same in the standard library and PunyInform. The way I interpret what you’re trying to do, I think this is a solution:

Object SouthRoom "The Entrance"
	with 
		description "An open doorway leads north.",
	go_turns 0,
	go_dir 0,
    after [;
		Go: 
			self.go_turns = turns;
			self.go_dir = selected_direction;
		Look:
			if(self.go_turns == turns) {
				if(self.go_dir == (s_to))
					print "^You could go back North to the Hub.^";
			}
	],
        n_to Hub;

This can also be turned into a class to make it easier to define many of these messages.

3 Likes

I’m just thinking aloud here, but what about using an each_turn property? I haven’t tested this, but it should work, as it runs at the end of each turn.

Object SouthRoom "The Entrance"
with
  description "An open doorway leads north.",
  after
  [;
    Go:
      if (Hub has visited)
        give self general;
  ],
  each_turn
  [;
    if (self has general)
    {
      give self ~general;
      "^You could go back north to the hub.";
    }
  ],
  n_to Hub;

Alternatively, you could make this a daemon that you start and stop, rather than using an attribute, so that it’s not running continuously. You could even have one daemon for all rooms and use some smarts to work out where you came from if PunyInform has an equivalent of the standard library’s prev_location global variable.

1 Like

From the example, seems that is a case for adaptive prose in the description… Your actual coding problem actually needs being handled by after or can be handled by a description routine ?

The example you give, implementing the player’s knowledge of the map, is conceptually a permanent change of room’s description, and can also be handled by changing room.description, but in a .z3 story, having two or more description of the same room isn’t precisely a valid solution, so better altering/modifying.

Best regards from Italy,
dott. Piergiorgio.