Here is a simplified version of the way I have tried to set up some scenes in a game. It uses the Questions extension, but I don’t know if that’s relevant or not to the difficulty I’m running into.
What I want to happen: the player types “x doodad,” is prompted with a question, and after answering the question, gets some kind of immediate consequence (either ending the game or changing the scene and location). It would also be nice if Scene 1 would end before Scene 2 begins. There are fair number of things in the game that depend on which scene is happening at the time, and I hadn’t really planned for overlap…not sure if it would cause problems.
What actually happens when you run the example: The consequence is not immediate–there’s an extra prompt between the question and the consequence.
What actually happens when you run the game: There’s an extra prompt between the answer and the scene change, AND the “Scene 2 is beginning” message displays before the “Scene 1 is ending” message, with the first/incorrect room description between them. (The room description appears in response to the command “look” which was typed at the extra prompt.)
Suggestions?
Example:
[code]Include Questions by Michael Callaghan.
Scene1 is a scene.
Scene1 begins when play begins.
Scene1 ends dangerously when InvestigatedTheDoodad is true.
When Scene1 ends dangerously, say “Scene 1 is now ending dangerously!”
Scene2 is a scene.
Scene2 begins when Scene1 ends dangerously.
When Scene2 begins:
Say “Scene 2 is now beginning!”;
Move the player to the Spaceship.
Scene9 is a scene.
Yard is a room.
The description of the yard is “It’s a yard!”.
A doodad is a thing in the yard.
Instead of taking the doodad, say ExamineDoodadRoutine.
Instead of examining the doodad, say ExamineDoodadRoutine.
To say ExamineDoodadRoutine:
If Scene1 is happening:
Say “Here’s a question for you.”;
Now current question is “Are you SURE you want to examine the doodad?”;
Now current question menu is { “no”, “yes” };
Ask a closed question, in menu mode;
Otherwise if Scene9 is happening:
Say “blah blah blah”.
InvestigatedTheDoodad is a truth state that varies.
InvestigatedTheDoodad is usually false.
A menu question rule (this is the DoodadChoice rule):
If the current question is “Are you SURE you want to examine the doodad?”:
If the number understood is 1:
End the story saying “You chose not to examine the doodad. How boring.”;
If the number understood is 2:
Say “You have chosen to examine the dangerous doodad! Oh no!”;
Now InvestigatedTheDoodad is true;
Exit.
Spaceship is a room.[/code]
Update:
So I’ve now tried the SCENE testing command on the game, and according to that, the two scenes in the game do not actually overlap. Apparently the first one ends, and immediately after that, the second one begins. However, I still don’t understand why the text that’s supposed to print when the second scene begins, would show up before the text that’s supposed to print when the first scene ends, or why the room description shows up between them.
Re: the example code above: adding a “stop the action” line immediately after “Now ExaminedTheDoodad is true” successfully gets rid of the extra prompt. But it also causes the game to get stuck in question mode. I haven’t been able to figure out how to get out of question mode and also skip to the end of the turn in order to activate the scene change.