Compound conditions

I have several places that moving in a nowhere direction gives pretty much the same result:

Instead of going nowhere from Thentis Road,
	say "[one of]That direction will take you off quest.[or]The road continues into the distance but away from your main objective.[or]If you search the chapel, perhaps we can be done before nightfall.[at random]"
	
Instead of going nowhere from Mercer Cove Road,
	say "[one of]That direction will take you off quest.[or]The road continues into the distance but away from your main objective.[or]If you search the chapel, perhaps we can be done before nightfall.[at random]"

I don’t know how to specify multiple conditions. I would prefer something like

Instead of going nowhere from Mercer Cove Road or Thentis Road...

but get an error for various attempted combinations.

One easy way to group together rooms when you want to specify rules in common among rooms is with a region.

The Road of Trials is a region.
Thentis Road is in the Road of Trials.
Mercer Cove Road is in the Road of Trials.

Instead of going nowhere from the Road of Trials:
	say "[one of]That direction will take you off quest.[or]The road continues into the distance but away from your main objective.[or]If you search the chapel, perhaps we can be done before nightfall.[at random]"

Writing with Inform 3.4: Regions and the index map

1 Like

A perhaps less idiomatic way to do it is to subtype the room, thus:

Instead of going nowhere from a Road-Room,
	say "[one of]That direction will take you off quest.[or]The road continues into the distance but away from your main objective.[or]If you search the chapel, perhaps we can be done before nightfall.[at random]"

A Road-Room is a kind of room.

Thentis Road is a Road-Room. 
Mercer Cove Road is a Road-Room. It is north from Thentis Road.

(Mentioned only for sake of variety: I actually prefer Zed’s solution.)

1 Like

Thanks to you both. I was thinking of making the groups of roads a region but now, if I do, that will solve this problem too. Works perfectly.

Or, just use an actual condition.

Instead of going nowhere when the location is Thentis Road or the location is Mercer Cove Road or…

Then you can use “and” and “or” and such as much as you like.

Or, as another option, you can use a new definition:

Definition: a room is roadlike if it is Thentis Road or it is Mercer Cove Road.
Instead of going nowhere in a roadlike room:

But I think a region is the best solution.

1 Like

I tried the compound condition (location is Thentis Road etc) but I couldn’t get it to work. The region solution worked well. Thanks for letting me know that it IS possible and that it was typical user error on my part.

The trick with that is you have to assert entirely for each object. It’s a subtle but important difference to Inform:

Instead of going nowhere the the location is Main Street or State Street:

should be

Instead of going nowhere when the location is Main Street or the location is State Street:

2 Likes

The former is, notably, a syntax that I6 supported but I7 doesn’t. I sometimes wonder why, because “value is option or option or option” isn’t especially ambiguous to parse. The typechecker handles worse ambiguities already.

It’s not hard to parse, but Inform’s “is” verb is extremely open-ended. You could write something like:

...when the location is Main Street or sunny or adjacent to Central Park:

Syntactically this can always be rephrased into “X is A or X is B or X is C” but the chance of landing somewhere the author didn’t intend is maybe too high.

I guess there’s also cases like

...when the location is sunny or adjacent to Central Park or Main Street:

This is genuinely ambiguous.

3 Likes