Manually starting a scene

Can I manually start a scene?

Background: I have a scene which works as intended, but I’m also using the extension Questions by Michael Callaghan, and I want to start a scene from within a dialogue. What happens is that the dialogue properly ends, but the scene is only triggered after the next move (e.g. wait, look). The scene is triggered by variable==1 (and variable can be set during the dialogue).

You can’t manually start a scene, but you can manually invoke the relevant rules, which might do the trick? You can do by including the line “follow the scene change machinery rule” at an appropriate point – I’m not familiar with how that extension works, but if there’s a place where you’re updating the variable, maybe that would be the point where you could put it in?

2 Likes

In how far do rules and scenes interact? I have a rule triggered by the Questions extension, but the scene is triggered by a variable being set to a certain value. I don’t see the connection yet.

Assuming Soliloquy is a scene, there’s nothing like a Start Soliloquy phrase. But you can say Soliloquy begins when soliloquy-condition is true and then now soliloquy-condition is true, which will then work like you’d hope Start Soliloquy would… eventually. This is where the complication that Mike refers to above comes in.

After whatever applicable Action rulebooks have run, the turn sequence continues:

  • Scene changing rules (check whether any scenes should begin or end and run corresponding when scene begins/ends rulebooks)
  • Every turn rules
  • Timed events tested for (at: rules)
  • Advance time rule: increments time and turn count
  • Update chronological records (updates relevant tracking for conditionals that compare things to the past, e.g., if the Lab was visited)
  • Scene changing rules again

So if in the course of processing an action a condition is set that will trigger a scene to begin, the normal course of things is that that won’t happen until the last Action rulebook finishes. So if your “carry out whatevering” rule said now soliloquy-condition is true and your “after whatevering” rule tested if soliloquy is happening, your after rule would think it still wasn’t happening.

But as Mike said, you can force the issue by manually invoking the scene changing rules and not waiting for it to come around in the turn sequence, e.g.,

now soliloquy-condition is true;
follow the scene changing rules;
3 Likes

I don’t get it. I used to start the scene upon saying something special to an NPC.

kenneth_action is a recurring scene. kenneth_action begins when flag_kenneth is 1.

Now I have changed the conversation to Questions by Michael Callaghan. That includes a rule.

A number question rule:
let X be the number understood;
etc.

The two are not related. How am I supposed to start a scene by invoking a rule?

Sorry, I’m not sure I fully understand the question – you’re right, the two things aren’t really related. Inform’s implementation of scenes is meant to be action-agnostic, so that it just needs to check at the end of each turn whether a condition indicating the need for a scene-change has been met.

Without having used this particular extension, I’m guessing the trouble is that it’s got a multiple-choice system that sits outside of Inform’s action-resolution system, so that the regular end-of-turn rules (which are very well outlined in Zed’s post) aren’t firing when the player pushes a number key, and therefore the player needs to type in an additional command before the scene changes. Thus the need to manually tell Inform it needs to check for whether it’s time to update a scene.

Maybe the confusion is the difference between two meanings of “how to tell Inform to start a scene”? That can mean “how to tell Inform what conditions need to be satisfied before a particular scene should start” – which is the first bit of code you’ve got – or it could mean “how to tell Inform it’s time to update what scenes are running”, which is the “follow the scene change machinery rule” phrase (BTW, I believe this rule is the only rule in the scene changing rulebook, so the slightly different formulations Zed and I used should be equivalent).

1 Like

It’s probably worth it to review Writing With Inform 10.9 Why are scenes designed this way?, which states (among other things):

There is no phrase with the power to say “make Act II begin right now”, so perhaps it is worth explaining why not. The state-based approach was chosen because:

  • it guarantees that each action falls entirely inside, or entirely outside, of any given scene (and therefore that “during…” clauses in the conditions for a rule are not affected by rule ordering);
  • it ensures that scene changes occur outside actions, like every turn rules;
  • it promotes a style of writing which makes it clearer to the reader of the source text when a scene begins and ends, and what conditions are guaranteed to be true during it;
  • it makes it possible for the Scenes index page to show this information in a communicative way.

What DeusIrae and Zed are pointing you to is the fact that, because of the way that scenes are designed, a change between scenes occurs only at fixed points in the turn sequence rules. These rules are normally always being run in the background of any game. See the Index; under “Rules Index / Standard” there is a section “The top level” that shows the rules in this rulebook, which is normally equivalent to the main loop of a running game.

The two mysterious blank lines are unnamed rules – unnamed to make it difficult to tamper with them. See the Standard Rules for the listing of rules in the turn sequence rulebook, under section “Section SR2/8 - The Standard Rules”:

A first turn sequence rule (this is the every turn stage rule): follow the every turn rules. [5th.]
A first turn sequence rule: follow the scene changing rules. [4th.]
The generate action rule is listed first in the turn sequence rulebook. [3rd.]
The declare everything initially unmentioned rule is listed first in the turn sequence rulebook. [2nd.]
The parse command rule is listed first in the turn sequence rulebook. [1st.]

The timed events rule is listed in the turn sequence rulebook.
The advance time rule is listed in the turn sequence rulebook.
The update chronological records rule is listed in the turn sequence rulebook.

A last turn sequence rule: follow the scene changing rules. [3rd from last.]
The adjust light rule is listed last in the turn sequence rulebook. [2nd from last.]
The note object acquisitions rule is listed last in the turn sequence rulebook. [Penultimate.]
The notify score changes rule is listed last in the turn sequence rulebook. [Last.]

Notice the two unnamed rules labeled [4th.] and [3rd from last.], both of which do the same thing: follow the scene changing rules.

It’s when the scene changing rulebook is followed that scenes are ended and begun in response to evaluation of the relevant conditions controlling when they start and end. What DeusIrae and Zed are pointing out is that you can insert the same statement into your own code to trigger scene changes.

That said, you will probably want to consider the impact of trying to trigger scene changes instantly in light of the cautions listed in WWI 10.9.

5 Likes

It works! Magic!

And I even understand most of the background now! :slight_smile: