Scene linking and conditions

Here’s the code:

When Scene 1 ends: if the finale flag is true: if the relationship flag is true: Scene 2 begins; otherwise: Scene 3 begins; otherwise: if the relationship flag is true: Scene 4 begins; otherwise: Scene 5 begins.

(Names of scenes have been changed to protect the innocent.)

The scenes themselves have already been defined elsewhere, and yet the error text returns:

You wrote ‘Scene 2 begins’ but this is a phrase which I don’t recognise, possibly because it is one you meant to define but never got round to, or because the wording is wrong (see the Phrasebook section of the Index to check). Alternatively, it may be that the text immediately previous to this was a definition whose ending, normally a full stop, is missing?

For context, this bit is at the end of my game. The two flags (relationship and finale) are truth states tracking two attitudes the player has towards different things. The four scenes are the four endgame scenes, which diverge based on the player’s attitudes.

Any thoughts on how to fix this and accomplish my goals here?

You can’t explicitly begin a scene that way, for reasons I don’t fully understand. Scene beginning/ending conditions are declared separately, ie. “Scene 2 begins when the whatchamacallit is on the whatsit. Scene 2 ends when the yoink is carried by the player.”

The easiest replacement is probably for you to set a couple truth states or numbers that you can manipulate when it’s time to start or end a scene, ie “2_toggle is a number that varies. Scene 2 begins when 2_toggle is 1. Scene 2 ends when 2_toggle is 0.” Then, in place of “Scene 2 begins”, you’d just toggle the appropriate variable, with a “now 2_toggle is 1” or whatever, and Bob’s your uncle.

I’ve never written anything with scenes (hell, I’ve never written anything with rooms), but isn’t this a job for multiple endings for scenes, as in section 10.8? If your ending conditions for scene 1 are relatively compact (say “we have kissed Clark”) then you could have something like:

Scene 1 ends casually when we have kissed Clark and the relationship flag is true and the finale flag is false. Scene 1 ends smoochily when we have kissed Clark and the relationship flag is true and the finale flag is true. Scene 1 ends sadly when we have kissed Clark and the relationship flag is false and the finale flag is true. Scene 1 ends inconclusively when we have kissed Clark and the relationship flag is false and the finale flag is false. Scene 2 begins when Scene 1 ends casually. Scene 3 begins when Scene 1 ends smoochily. Scene 4 begins when Scene 1 ends sadly. Scene 5 begins when Scene 1 ends inconclusively.

Not tested even for compiling, or for whether I lined up your conditions with the scene numbers.

Well, if you need every scene to have a starter-button, would this work?

[code]A scene can be active or dormant. A scene is usually dormant.
To launch (play - a scene): if the play is dormant, now the play is active.

Home is a room. The Black Swan is a scene. The Black Swan begins when the Black Swan is active.

Instead of jumping: launch the Black Swan.[/code]

The only real niggle is that you need to define each scene as beginning when [name of scene] is active (and you have to use the above syntax, too – it apparently doesn’t work if you substitute “it”).

Gravel, it is not true that you can’t begin a scene that way – at least, if it’s all one sentence. In fact, in the i7 manual it is explicitly stated that you can begin a scene saying “When Scene 1 ends, Scene 2 begins.” That said, it’s quite possible that the problem I’m having is the conditionals, in which case there must be some workaround… I can’t be the only person who’s had this problem.

Matt W, that was a very early thought I had. The main reason it doesn’t work appears to be that you cannot have multiple variables affecting how the scenes end. That seems really silly to me, but it also appears to be true (and folks on the ifMud agree, which makes me think it’s not just some alternate problem). That’s not to say that the ultimate solution might not involve multiple scene endings, it’s just that I can’t see how right now and I don’t think it’s something that can be solved with easy reference to the i7 manual. (I don’t think.)

Eleas, the issue is that I specifically don’t need each scene to have a starter-button. There should be one starter button - which I have already taken care of (Scene 1 ends based on that starter button). At that point, all the various numerical values that the player has generated, indicating their attitudes about different topics, should be tallied and the output results in them going to one of four possible following scenes. Does that makes sense?

Right, sorry, I should have been more specific. You can’t directly start a scene within conditionals, and you can’t create new rules to start a scene in the middle of the game - as I understand it, the conditions are set out ahead of time.

Hrm. If that works (as opposed to “Scene 2 begins when scene 1 ends”) it seems like it must be a special case to me. The docs at 10.2 say that “Scene 1 begins…” can be followed by any condition, which will be something like “we have kissed Clark” or “Dirk is in Professor Regius’s study” or “The player holds the rubber chicken.” (I think.) But it can’t be done as a standalone phrase, as in “After taking the rubber chicken: Now scene 1 begins,” the way you could say “After taking the rubber chicken: Now the player is embarrassed.” See section 10.9:

Oh, phoo. Well, if that’s the problem then I’d try some kind of decide phrase, along the lines of:

To decide whether romance triumphs: if the relationship flag is true and the finale flag is true, yes; no.

And then you can say “Scene 1 ends smoochily when we have kissed Clark and romance triumphs. Scene 2 begins when Scene 1 ends smoochily.” etc. (Sorry for the examples, though I do feel they are faithful to the spirit of 10.8 of the documentation.)

It’s true that you can’t tack more conditions to the “scene X begins when scene Y ends” phrase, but you can everywhere else and you can go around even that special case. The easiest but a rather wordy solution is to use “scene X begins when scene Y has ended and the time since scene Y ended is 0 minutes” that is functionally the same but allows for more conditions:

Scene X begins when scene Y has ended and the time since scene Y ended is 0 minutes and the player is carrying the duck.

Another way is to use named endings:

[code]
Scene Y ends duckily when we have examined the duck and the player carries the duck.
Scene Y ends duckless when we have examined the duck and the player is not carrying the duck.

Scene X begins when scene Y ends duckily.[/code]
I haven’t tested Matt W’s solution, but there doesn’t seem to be any reason it wouldn’t work: he doesn’t use any conditions in the “x begins when y ends” phrases.

Just quickly wanted to say thanks Juhana and Matt - I feel like I know why it was failing now and also like I have a few directions to go. Later today I’ll try and implement it and see if it works! But since I can now see several ways that should work, I don’t think it’ll be a problem.