I want to be able to trap the first visit to a room after a scene begins. The player will have visited the room earlier, but since then a particular scene begins and I want to be able to respond to the player’s first visit after the scene begins.
Drawing on Jim Aiken’s example (p225 of his handbook) I could have
“Breakfast is a scene. Breakfast begins when the rooster crows. Breakfast ends when the player is in the Wine Shop for the first time.”
It is possible that the player has been in the Wine Shop before the rooster crowed - how do I amend the code to capture the player’s first entry to Wine Shop after Breakfast begins?
You could simply say “Breakfast ends when the player is in the Wine Shop.” Then the scene ends the next time the player enters the Wine Shop.
If it’s possible that the rooster crows while the player is already in the Wine Shop and you don’t want the scene to end immediately, you could do something like “Breakfast ends when the player is in the Wine Shop and the time since Breakfast began is at least 1 minute.”
Or something like:
After entering the Wine Shop:
if Breakfast is happening:
You can also tag stuff with an either-or condition. For instance:
A person can be enthused or unenthused. A person is usually unenthused.
When Breakfast begins: now the excitable sommelier is enthused.
if the player can see the excitable sommelier:
if the excitable sommelier is enthused:
say "The sommelier waxes rhapsodic about the wines of Australia."
… etc. Of course, if you want the sommelier to shut up at some point, you’ll need to add a condition to turn him unenthused again.
Thanks heaps for the replies, Juhana and Merlin.
The scene is independent of entering the room so ending the scene there is not an option. Merlin’s plan A is exactly what I need - rookie error to not think of that myself