Enter and exit room with different scenarios - Inform 7

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!

1 Like

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

If the goal is to have the event happen no matter what the player does (waiting, examining, talking, etc), I’d use an Every Turn rule.

Every turn when the player can see Joel and Joel is in the Unified Command Room:

The end result is similar, but there’s a key difference: you can always expect Every Turn rules to trigger, no matter what else is going on. By default, the first After rule that applies will cut off all the others (and also all the Report rules), and you need to explicitly “continue the action” to avoid this behavior.

2 Likes

I am not sure if I am doing this correct but if I change the code to

Try "After doing anything 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.

the I get the following error:

Try error1

This event should actually happen on a number of occasions with different people as meetings will be held in different rooms and sometimes people from one room will be in the next meeting room as well.

Why I am trying this is when I make Joel active in room1 and the meeting moves to room2 and Joel will be that meeting as well the I cannot make Joel active in room2 as it sees Joel as part of Room1.

Maybe3 I am approaching this whole thing wrong and there is a possible way to just deactivate Joel from room1 and activate him again in room2 and so on.

That will be an much easier way but I do not know how to accomplish that.

Thanks for all your help but this code seems to do the trick for now:

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

I will see how it goes and if I can use it with the rest of my code , if not I will be back. :smile:

I meant to sub in what I had in quotes for your rule preamble (the bit that starts with After and ends with a colon)- “try” is actually something you can use in the most of a rule to force a player action, but it doesn’t belong in a rule preamble like this.

With that said, @Draconis’s point about how After rules function might mean it’s better to use an every turn rule instead if you have other effects you want to have fire off beyond just this one. I didn’t really understand your response to him - if characters are moving around a bunch you might want to consolidate into a single large rule to handle this rather than having a bunch of separate ones, but there shouldn’t be any reason why an every turn rule would work differently than an after rule in terms of the conditions you can put on it.

Thanks your code did the trick

Thanks, every turn rule did the trick.
As a newbie it is like learning a new language but I will get there.