Creating "Chatted" and "Unchatted" NPC states

I am creating a game where the player must talk to NPCs to trigger certain events. I have created the following rule:

Understand "talk to [someone]" as chatting.
chatting is an action applying to one thing.

A person can be chatted or unchatted. A person is usually unchatted.

Check chatting:
	if the noun is not a person:
		say "You can't talk to that!" instead;
	if the noun is the player:
		say "Stop talking to yourself!" instead.

Carry out chatting:
	now the noun is chatted;

This worked great the first time, but my issue is when I begin a new scene and try to label the NPC (e.g. Rob) as “unchatted” I get this error:

You wrote ‘Rob is unchatted’ : but this is a phrase which I don’t recognise, possibly because it is one you meant to define but never got round to, or because the wording is wrong (see the Phrasebook section of the Index to check). Alternatively, it may be that the text immediately previous to this was a definition whose ending, normally a full stop, is missing?

I know I need to make some rule about this, but I am totally stumped

As Mike said in your other thread, creating a new scene doesn’t mean that anything written below that point is part of the new scene.

Anything that is not in a rule is part of the initial state of the game (before any scenes start). And in fact, for the most part the order you write things in is irrelevant.

If you want something to change when a scene starts, you need to put it inside a When (scene name) begins rule. If you want other things to only apply when a particular scene is happening, then you need to say that too.

(And inside a rule, you can’t make a plain assertion like Rob is unchatted – you have to tell Inform to make it so via now Rob is unchatted or even now every person is unchatted.)

Have a read through the whole chapter on scenes before you start trying to play with them. Perhaps try out some of the examples as well, before you try applying it to your own story.

1 Like

Thank you!!! I am a very new to this program and learning the proper syntax to put everything in. Putting this-

when (scene name) begins:
now every person is unchatted

worked like a charm! Thank you again!!!