[Solved]Ending a scene when an item is examined

I had trouble doing this a few days ago due to being new to using scenes but only just got back around to it; I need this scene to end after forcing the player to examine a key and displaying plot text, and when it ends move the player through the door. Using the “if scene has ended” statement, I wanted to create a rule that forces the player to lock a specific door after every use for story telling purposes. I’ve tried several ways of saying it but I got it wrong each time so I’ve removed that bit. How do you declare when to end a scene?

I’m using smarter parser and locksmith extensions but I haven’t included them in the modified example code, I’ve stripped out all unneccessary bits in order to save space and make for easier reproduction. (I’m using others but they aren’t going to affect this action)

View as raw and copy/paste, pastebin doesn’t keep tabs in the main view.
pastebin.com/raw.php?i=7YZaTZ5c

I’ve poured over the scenes section of the documentation and tried to adopt the examples for my purposes but I never saw what it was that made a scene actually end.

To get to the scene area, simply enter F for gender (I commented out the male section since I haven’t written that yet), and then go up from the starting area. The only action included is placing the key in the player’s holdall when the scene begins.

I’ve had trouble with scenes, too. I make properties with weird names to help. So to end a scene after a player takes something, I would do this:

[code]a thing can be pilfered or unpilfered. a thing is usually unpilfered.

instead of taking the magic item:
now the magic item is pilfered;
continue the action.

magic scene ends when magic item is pilfered.[/code]

In your example, the line

Always Lock the Dorm Behind You ends when the key is examined.

is sufficient. (The “scenes” debugging command verifies this.)

Note for onlookers: “when X is examined” is not a built-in I7 feature. It works here because the sample code declares

A thing can be examined or unexamined. A thing is usually unexamined.
Carry out examining something: now the noun is examined.

You can use actions in scene definitions.

The example scene ends when the player examines the thingamajig.

That should work for a recurring scene. (The examined property won’t as once it’s true, it’s always true). You can attach the game logic to either examining the thingamajig or to the scene ending.

I did something similar to that. At the beginning there’s a rule for examined and unexamined. I don’t know why, but now everything seems to be working correctly. I’m positive I used the exact same syntax last week and it didn’t work, but this seems to have done the trick:

Always Lock the Dorm Behind You ends when the Dorm Key is examined. When Always Lock the Dorm Behind You ends: say "The scene has ended."; try entering the Jovelle Slums Church Female Dorms Door.
It used to fuss at me saying there’s supposed to be an if statement following the “scene ends when” line, but I think I might have used a slightly different prefix on that line the first time around. I might have started it as, “The Always… ends when…” but I’m I’m not sure if that’s enough to throw it off. The interpreter can be rather exact in it’s requirements, so it’s possible that by including the at the beginning it might have thought I was referring to something other than a scene, or some other something that caused it to think that.

I’m having trouble locating the right section in documentation that explains things similar to, say:

“If the player is in x room for 1 turn” or making something happen during the first turn a player is in a room. I came across this earlier but now I can’t find it, and can’t remember it.

This kind of thing?Every turn: If the player has been in the beach for 1 turn, say "This beach is getting dull."

Yes, that kind of thing. It’s simple, but I forgot it due to not using it.

I believe this would be adequate for creating a rule to lock a door if something else has happened. I’ll get back to this after I eat.

No, that doesn’t work.

Every turn: if Always Lock the Dorm Behind You has ended: if the player has been in Jovelle Slums Church Female Dorms for 1 turn: try closing the Jovelle Slums Church Female Dorms Door; now the Jovelle Slums Church Female Dorms Door is locked; if the player has been in Jovelle Slums Church Dorms for 1 turn: try closing the Jovelle Slums Church Female Dorms Door; now the Jovelle Slums Church Female Dorms Door is locked.
Is there a way to make this happen on the same turn the player enters through the door, or perhaps a way to use the entering action as a trigger? This locks the door 1 turn after the player enters the room.

I’ve tried

Every turn: if Always Lock the Dorm Behind You has ended: if the player enters the Jovelle Slums Church Female Dorms Door: try closing the Jovelle Slums Church Female Dorms Door; now the Jovelle Slums Church Female Dorms Door is locked.But this is incorrect. I originally tried “try lockng…” instead of “now… is locked” but that didn’t work. What’s the correct syntax for locking a door using try?

After going through the Jovelle Slums Church Female Dorms Door when Always Lock the Dorm Behind You has ended:
    try closing the Jovelle Slums Church Female Dorms Door;
    try locking the Jovelle Slums Church Female Dorms Door with the Dorm Key; [note you have to say which key!]
    continue the action.

Note that this one won’t trigger during your “When Always Lock the Dorm Behind You ends” rule (which in your above example has a “try entering the door” phrase), because the scene hasn’t truly ended yet. You could add a similar “After going through the door during Always Lock the Dorm” rule.

Removing the try entering section and using this afterwords creates the situation I need. The rule creates the action and the scene creates the story; so I don’t have to dance around this part anymore.

Thanks everyone; I’m marking this as solved.

You don’t have to go through the “try” actions, since you know there’s no chance of failure. It’s simpler and faster to write

now the the Jovelle Slums Church Female Dorms Door is closed;
now the the Jovelle Slums Church Female Dorms Door is locked;

Thanks for pointing that out. There will be a time when plot requires it to fail, so I’ll leave room for that instead. There are other areas I can apply this to in my source however, so it’ll be put to use.