Changing truth state of a person's property

Simple question: I want to track, change, and be able to query whether or not the player is employed. (Inform 7).
I have written:
A person has a truth state called employed.

This works in that when I type “showme myself” or some other character, it lists the property like:
employed: false.

So, how do I change that state??? Every time I try “The player’s employed state is true.” or something like that I get some error, like you’re “you’re saying one thing is another thing.”
I just want to change and be able to track whether or not she’s employed and use that boolean for actions! Help!

I think it’s now the employed of the player is true ? “now blah blah blah” is how you tell Inform to set a vaue.


Yup. This trips up everyone at the start. An Inform 7 program is a series of assertions. The specifications of Definitions, To-Phrases, Rules, Timed-event-rules-with-At, When-a-scene-begins/ends are themselves assertions, but within those things you can’t have assertions; you must have one or more phrases.

So outside of Definitions, To-Phrases, Rules, Timed-event-rules-with-At, When-a-scene-begins/ends (it’d be nice if there were an agreed upon collective term for them… at least one place in the docs suggest the others could be considered special cases of rules, but a couple of different places say they shouldn’t be) you can have a sentence that acts as an assertion.

Mostly just because it flows better with natural language, let’s say instead of person has a truth state called... we go with A person can be employed or unemployed. It’s a lot nicer to write if p is employed than if the employed of p is true. Then we can assert, plainly:

The player is unemployed.

But while a plain sentence can be used as an assertion, it can’t (alone) be a phrase, but you can make it part of a Now phrase:

To fire (p - a person):
  Now p is unemployed.

To make things more fun, some verbs mean different things when used in assertions, imperative statements (“imperative” isn’t formal terminology from the docs; Ron Newcomb’s Inform 7 for Programmers uses it), and conditionals. For instance, “to have” in an assertion asserts something has a property. In a conditional, it tests whether a person either wears or carries something. But in an imperative, it means just “to carry”. In a conditional, if X holds Y is true if X wears Y, X carries Y, X contains Y, X supports Y, or X incorporates Y (i.e., Y is a part of X). In an assertion or an imperative it just means “carry”.

[ Edited: I had said “At-phrases” originally, but that’s misleading at best, so I replaced it with “Timed-event-rules-with-At”. And I had forgotten When-a-scene-begins/ends as another assertion whose body is one or more phrases. ]


Great- thank you!

Thank you! I really appreciate the explanation. I’m really enjoying writing IF and find it to be an amazing “programming” language. The support in this community is terrific, too.