help modifying a thing to have a color property

I’m trying to implement a system in which the player recieves Spirit (as an object). In order to do this I’d like to have three different colors of spirit and then have the description of the player change based on which color of spirit they currently have. Is there a way to do this?

Lots of ways. Easiest way is probably to set a “Spirit” property for the player. I think you’d have to do text replacement, though, because Inform will only let you do a single if/else conditional in a say statement. Something along the lines of:


To say spirit_description:
     if the spirit of the player is blue:
          "You glow with a faint blue aura."

The player has a property called spirit. The spirit of the player can be blue, red or green. The description of the player is "[spirit_description]".

Changing the spirit property is as easy as:

Now the spirit of the player is red.

Untested and very incomplete example, as I’m at the office dodging actual work. Hopefully that’s enough to explain what I’m trying to say.

If the player has to choose between different spirits, it may be useful to be able to differentiate them. There are numerous examples that explain how to use properties to alter the name and parsing of objects. The first one I found after quickly browsing through the recipe book was “Lemonade.” It’s way more complicated than you need, so I’ll quote just the relevant parts here:

[code]Liquid is a kind of value. The liquids are water, milk, lemonade, and iced tea. A fluid container has a liquid.

Understand the liquid property as describing a fluid container. Understand “of” as a fluid container.

After printing the name of a fluid container (called the target) while not examining:
unless the target is empty:
say " of [liquid of the target]";
[/code]

Thanks, that makes a lot of sense! I’ve been tripped up a little in implementing it though as when I try inputing “The player has a property called spirit. The spirit of the player can be blue, orange, or green…” I get a message saying “only a room, thing or kind can have such adjectives applied to it…” Any ideas how to get past this?

Say yourself'' or another specific person instead ofthe player.’’ The player is a person that varies, so if Inform accepted the code you quoted there would be some question as to what would happen if the player changed identity. ``Yourself’’ is the default identity of the player, and probably what you meant.

That’s not the right syntax. You’re not supposed to use the word “property” - it’s not a keyword. Try this, like in the lemonade example:

Color is a kind of value. The colors are none, red, blue and green. The player has a color called spirit.

Edit - EmacsUser has a good point, but in this case it seems to work even when you do use “the player” instead of “yourself.”

…which is why I should try things before posting. Thanks, capmikee.

I think you could also say this:

The player can be red, green, or blue (this is its spirit property).

As in section 4.10 of the documentation. (Or does this only work with kinds?)