Trying to trigger event specifically in one room HELP

Please could somebody give me some guidance. I’ve been scouring the documentation and Google for hours.

I managed to get this working after a bunch of trial and error (hurray :slight_smile:):

After entering a chair for the first time:
	say "Ma puts breakfast down. She hands you the prescription ";
	now the player carries your prescription.

However, this is making the compiler very unhappy:

After entering a chair for the first time when location is the kitchen:
	say "Ma puts breakfast down. She hands you the prescription ";
	now the player carries your prescription.

I’m a little confused because whilst it won’t accept above, the compiler will accept:

Understand "kitchen chair" or "chair" or "at table" or "at kitchen table" as kitchen chairs when location is the kitchen.

I’m sure there will be some lovely on here who can hopefully point me in the right direction?

Thanks,
aiya x

I am very much an Inform newbie, but “After entering a chair in the kitchen for the first time” works for me – maybe stacking conditions after “for the Xth time” isn’t something the compiler understands?

1 Like

The way that the Inform 7 compiler treats for the first time ... when ... is kind of counterintuitive. There was a recent discussion about this that might be helpful to look at.

But it seems to me that the easiest way to solve this is just to make a sub-type of chair (maybe kitchen chair?) that happens to only occur in the kitchen:

A chair is a kind of supporter. A chair is always enterable. A kitchen chair is a kind of chair.

Kitchen is a room. Living Room is north of kitchen.

Your prescription is a thing.

The comfy chair is a chair in Living Room. The sofa is a chair in Living Room.

The stool is a kitchen chair in Kitchen. The rocking chair is a kitchen chair in Kitchen.

After entering a kitchen chair for the first time:
	say "Ma puts breakfast down. She hands you the prescription.";
	now the player carries your prescription. 
2 Likes

Oh my God!!! Of course! A subtype! Why didn’t I think of that???

Thank you so much, Patrick, you’re a gem x :heartpulse:

(also thank you for ref, very helpful)

1 Like

Glad to be helpful! Good luck with your project. :slight_smile:

For what it’s worth, I’m always wary of “…for the first time” conditions for anything plot-relevant. I’d do something like:

After entering a chair when the prescription is unhandled:
    say "…";
    now the player carries the prescription;
    now the prescription is handled.

“Handled” is a default property that indicates if something’s been picked up or not. I believe it’s automatically set at the end of each turn, but it doesn’t hurt to be explicit about it here.

1 Like

I7 requires when to be listed before for the first time, so this will work as expected, even though it sounds backwards in English (i.e. the rule will apply the first time that both of the things are true, ignoring cases when only one or neither is true):

After entering a chair when location is the kitchen for the first time:

The other thread isn’t entirely relevant here; that talks about how this doesn’t work as expected specifically for combining it with during scene. But when and for the first time do combine correctly.

2 Likes

also a good solution! ty

ahhhh, i didn’t think that it would be listed the other way around. thank you so much!! knowing this will help me with other stuff too :sparkles: