Checking going with additional clause

Is there a way to add that conditional clause to my “check going”? My made-up when the heading is not north is the problem is this example:

The player is in Library. Kevin is a person. The player is Kevin. Gallery is east of Library. Office is south of Library. The Street is north of Library.

Check going from the Library when the heading is not north:
	if the player is Kevin:
		say "The guard watches you.".

The real game has a bunch of rooms connected to the library, so it’s not practical to have a version of Check going north when the location is the Library: for each cardinal direction. (Especially since I have a ton of “if” statements underneath as well.)

North is the noun for this case.

Perhaps the most seductive beauty of Inform 7 is the ability to very quickly adapt the language to your own idiom. There’s no “heading” by default (because it is redundant to the existing noun global variable, as zarf notes), but creating one is simplicity itself:


Place is a room.

The going action has a direction called heading.

Setting action variables for going:
    now heading is the noun.

Other Place is east of Place.

Yet Another Place is north of Place.

Check going from Place when the heading is not north:
    say "You think it might be wiser to go north." instead.

Test me with "e / n".
1 Like

Perfect, thank you! (Yeah, I use “heading” for NPC movement, and before I came here I had hoped by some accident it would work for this use too-- obviously it did not.)