Enter and exit room with different scenarios - Inform 7

I am not sure how to explain my problem but let’s give it a go.

I created two rooms (Room1 and room2).

Room1 is where the game will begin with an NPC called Westley greeting everyone and the game continues from there.

Somewhere along in the game the player has the option to go to Room2 that is locked.

I can unlock the door and enter Room2, no problem there.

In Room2 the game continues but again at some point the player needs to go back to Room1.

That I can also do, no problem.

The problem is when I entered Room1 from Room2 the NPC called Westley started all over again with his greetings and what follows.

What I need is when the player enters Room1 from Room2 NPC Westley should not be greeting or doing what he has done when the game began in Room1.

Can someone please give me advice on how I can fix this please.

There are many ways this could be accomplished, and which one is applicable here is largely dependent on what the trigger is for starting Westley’s routine. Perhaps you could give some simplified example code?

Like this?

I will try to show the code that matters from two different parts of my code.

First the beginning

The Meeting Room is a room. 
Unified Command Room is a room.
Strategy Meeting Room is a room.

Westley is a man in the Meeting Room. "Hello, I'm Westley Magara from Virginia DEQ. I'm going to let the other agency administrators introduce themselves.[paragraph break]You can talk to Westley.".

Then later in the game the player can move to one of these rooms like:

Instead of talking to Westley, start a conversation with Westley-cic.

Westley-cic is a choose-once chat node with quip "Westley".
"'Okay, we want to turn it over to Sherry, the current incident commander now to give us an update on current operational
 conditions. [paragraph break]After this update use the blue keycard to enter the Unified command Room.".

The player can unlock and enter the Unified Command room with the blue keycard, no problem.

Now when the player wants to return to the first room, the meeting room, the first quoted code needs to change to something different.

For instance, Westley left and the room is empty or something like that.

So, in short, the first part of the code (description of Meeting room) must not be the same when player re-enters it for the second or third time.

It should thus be dynamic if that is the correct word.

If I’m reading your code properly, Westley’s dialog is contained in his initial appearance. The initial appearance property is text Inform adds to a room description when an object in the room has an initial appearance set and the object hasn’t been handled (i.e. moved by the player). When you type some text in quotes immediately after declaring an object, that text becomes the object’s initial appearance. The initial appearance is useful if you want to say something special about an item without it falling through into the “you can also see” section of the room description.
e.g.

"Smash"

Glass Hall is a room. "A long hall, every surface panelled in glass like the rest of this place." [the room's description]

The hammer is a thing in glass hall. "You spot a large hammer by one wall. Finally, something to break the panels with!" [the initial appearance of the hammer.]

In that example, the hammer will gain the handled attribute when it is picked up, and lose its initial appearance.

So what’s happening with Westley is this: Every time the player looks while he’s in the room, he’s going to say his welcome bit, since by default there’s a rule to prevent you from taking NPCs. Since presumably you only want Westley to welcome everyone once at the beginning of the game, you probably want a scene. Scenes are basically a way to split your game up into events. You can write all sorts of rules about when and how a scene starts and ends, where to move things when that happens, things that can only happen when a certain scene is happening, and, mostly importantly for this discussion, what to say when a scene starts. Something like this should get you started:

Westley Welcomes Everyone is a scene. "Hello, I'm Westley Magara from Virginia DEQ. I'm going to let the other agency administrators introduce themselves.[paragraph break]You can talk to Westley." [the scene's beginning text]
Westley Welcomes Everyone begins when the entire game begins.

And now Westley will welcome everyone when the game starts, and at no other time. You can freely move him around and design his conversation. There may also be a way to do this with whatever conversation extension you’re using, but I’m not familiar with how it works.

EDIT: The chapter on scenes in Writing with Inform may be useful reading.

2 Likes

Thanks, I will give it a go.
Looks like this might just work for me.

These code lines show what I need but it puts it right at the top before everything else.

Hello, I'm Westley Magara from Virginia DEQ. I'm going to let the other agency administrators introduce themselves.

You can talk to Westley.

Simple Chat node
An Interactive Fiction by Willie J Botes
Release 1 / Serial number 220709 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

Meeting Room
You can see Westley, Strategy Meeting Room door and Unified Command Room door here.

>

I need the top part of Westley to be shown under the Meeting Room and you can see… line.

I think it has something to do with the line:

Westley welcomes everyone begins when entire game begins.

I have changed it to:

Westley welcomes everyone begins when play begins.

But nothing changed.

How do I move that Westley part to underneath the Meeting Room part?

Ah yep, my mistake, not yours. :) I remembered a non-scene related solution, this’ll do what you wanted (tested).

After looking for the first time:
	say "Hello, I'm Westley Magara from Virginia DEQ. I'm going to let the other agency administrators introduce themselves.[paragraph break]You can talk to Westley."

Which yields:

Meeting Room
You can see Westley, Strategy Meeting Room door and Unified Command Room door here.

Hello, I'm Westley Magara from Virginia DEQ. I'm going to let the other agency administrators introduce themselves.

You can talk to Westley.

>

My previous solution didn’t work because of the order Inform does things in. “The Entire Game” is a scene, beginning when play begins and ending when the story ends. Apparently scene changes get calculated before the banner text is even printed, which is why you were getting the welcome scene description above the banner.
My new solution works because a rule (called the initial room description rule) automatically generates a look action after the banner text is printed, so this is “looking for the first time”.

Thanks, looks like it is working now.

I will continue my coding and as I come across a problem, I will seek your and others advice,

I really appreciate everybody’s contributions on my learning journey of Inform 7

1 Like

Happy to help. Have fun!

Sorry I am back again.

I am trying to move a player from one room to another with the following code but it does not seem to work:

Instead of waiting in the Unified Command Room:
	say "Let's go to the Strategy Meeting Room. said Joel.";
	move Joel to the Strategy Meeting Room.

The code compile but no Joel in the strategy meeting room.

What am I missing?

now Joel is in the Strategy Meeting Room.

Still no Joel?

Maybe my code is in the wrong place.

Not sure where to place it than after the unlock and entry to the strategy meeting room

I’m not sure what you mean by this. Could you post the code before the code that moves Joel? I was able to move them with this:

Unified Command Room is a room.
Strategy Meeting Room is a room.
Joel is a person in Unified Command.

After waiting in the Unified Command Room when the player can see Joel:
	say "'Let's go to the Strategy Meeting Room,' says Joel.";
	now Joel is in the Strategy Meeting Room.

Which yields:

Unified Command Room
You can see Joel here.

>z
"Let's go to the Strategy Meeting Room," says Joel.

>l
Unified Command Room

>

Thanks, Let me try my code there and I will come back to you

I still do not get any Joel.

This part of the code just before the moving part:

Unified Command Room is a room.
Strategy Meeting Room is a room.

Joel is a man in the Unified Command Room.  
Ben is a man in the Unified Command Room. It is undescribed.
John is a man in the Unified Command Room. It is undescribed.

After waiting in the Unified Command Room when the player can see Joel:
	say "Let's go to the Strategy Meeting Room. says Joel.";
	now Joel is in the Strategy Meeting Room.

Not sure it looks very similar to yours.
I can just mention I use the easydoors extension to move between rooms.

Sorry, it is actually working.

I just did not know about the time passes part when pressing z.
How can this be happening automatically without pressing z.

You should be able to change the rule condition to “After doing anything [in the UC etc.]”. An Every Turn rule can also work in these kinds of situations though I think the former approach is better here.

1 Like

I am not sure how I should change my code to your suggestion with the After doing…

After waiting in the Unified Command Room when the player can see Joel:
	say "Lets go to the Strategy Meeting Room. says Joel.";
	now Joel is in the Strategy Meeting Room.

Try “After doing anything in the Unified Command Room when the player can see Joel:”

(Sorry, on my phone so it’s hard to preserve the formatting)

Let me try and see if I can figure it out.

Thanks, no problem with the phone :smiley:

1 Like