Player Attributes (Values)

What I want to do is give my player character a number of conditions that will, in time, help my story branch out based on past events. So, here are two examples:

The player can be either aquaphobic or not aquaphobic.

This doesn’t work because only ‘a room, a thing, or a kind’ can have such adjectives. However, I have found that the following does work, although I wonder if it’s right that I should apply a condition to all persons when all I want is for it to be the player.

A person is either aquaphobic or not aquaphobic. The player is not aquaphobic.

I’m just having trouble introducing a trait called Disobedience. The player starts off obedient. However, if they repeat a task - and the game warns them otherwise - they move to warned, then disobedient (and something happens). It’s the sort of thing I would normally just use an incrementing number variable for in regular programming.

Not getting anywhere with the below:

A person has a value called Disobedience. The disobediences are disobedient, warned, and obedient. The Disobedience of the player is obedient.

I imagine that’s because the player is technically a variable (which points to a specific object that I don’t know how to refer to). There’s probably a simple I6 way to expose that object, I’ll look into it. For now you can make those global variables.

For the second, try this.

Disobedience is a kind of value. The disobediences are disobedient, warned, and obedient. A person has a disobedience.

Or this.

A person can be disobedient, warned, or obedient (this is the disobedience property).

The first effectively makes an enum which can be used in other places as well, the second only defines it for this one property.

Thanks. After I typed this, I discovered the thread with the link to the Slouching Towards Bedlam source, and found a line about truth states.

So, I was able to create this line:

The player has a truth state called aquaphobia. The aquaphobia of the player is false.

On the disobedience, I’ve put this, based on your reply:

Disobedience is a kind of value. The disobediences are disobedient, warned, and obedient. A person has a disobedience. The disobedience of the player is obedient.

I suppose I could live with never having to refer to any other person’s disobedience, I just wouldn’t want to if it could be more efficient (that’s assuming efficiency is even relevant).

Generally the concern now is more with speed than memory usage, and I don’t think it would cause slowdown. But you’re right, it could be better. I suppose you could make a global called the player’s disobedience (using the possessive) instead of assigning it to the actual player object.

One thing here is that the name of the default player object is “yourself,” so if you haven’t given the player a distinct identity (via something like “Maria is a woman in the Kitchen. The player is Maria.”), you can say this:

Yourself can be obedient, disobedient, or warned (this is its disobedience property).

If you have given the player an identity, then you can just replace “yourself” with “Maria” in the above code. Draconis, I guess this is the answer to how you refer to that specific object.

The reason Inform doesn’t like this with “the player” is that “the player” can be changed during play, and the properties that things have have to be set at compile-time. So if we had a property that applied only to the player, and in the middle of the game we declared “Now the player is Lily,” we’d be up the creek. (I guess “The player is not aquaphobic” works because it’s just setting an initial value, and Inform is happy to do that at startup for whoever happens to be the player at startup.)

Another thing is that, if all you really care about is the player’s disobedience and you’re using a counter to keep track of it, you could use a couple of “To decide” phrases to set it:

To decide whether the player is obedient: if the warning count of the player is less than 3, decide yes. [etc.]

Or:

Disobedience is a kind of value. The disobediences are obedient, disobedient, and warned. To decide which disobedience is the obedience state of the player: [some code]

There are several ways to do this, depending on how flexible you need to be; see sections 11.16-17 of Writing with Inform. For instance, in the first one I wrote you can’t use any phrasing other than “if the player is obedient” to check it – Inform doesn’t know that you’re checking a property of the player, you may as well have written “To decide whether potrzebie bounces” for all it can tell. Anyway, there are a few different ways you can do this that would avoid the need to set the disobedience property by hand.

Aha, that’s it. Thanks Matt.