Changing a description

I want to have an initial description of a thing that after a second “look” will read differently. Any suggestions?

There are several ways to do this but to my mind the best is to set the description to “[one of]First description[or]Second description[stopping].” See docs about alternatives in text (this is one of the single most useful sections of Writing With Inform, I think!)

1 Like

Great! Now say I want the description on a thing to change depending on which room the player is in. How would that look?

how many rooms/descriptions?

1 Like

Let’s say that only one room get a unique description while all other rooms get a standard description.

The description of the white cube is "It's a white cube[if the location is the red room], but the red lights make it appear red[otherwise if the location is the green room], but the green lights make it appear green[otherwise]. There's nothing special about it[end if]."

2 Likes

I’m not sure if it’s a quirk of my mind or some other challenge, but I have a really hard time reading conditionals in a text block. I would do something like this, just so I could easily read it, even if it seems overcooked. I think you might need to account for carried items, too, so think that over.

If you had to deal with a bunch of descriptions, you’d likely need to do checks by room or build a table :grimacing:

room1 is a room.
room1 is north of room2.

the thingamajig is in room1.

check examining the thingamajig:
	if the thingamajig is enclosed by the player:
		if the player is in room1:
			say "The thingamajig is in room 1." instead;
		otherwise if the player is not in room1:
			say "The thingamajig is not in room1." instead;
	otherwise if the thingamajig is not enclosed by the player:		
		if the thingamajig is in room1:
			say "the thingamajig is in room 1." instead;
		otherwise if the thingamajig is not in room1:
			say "the thingamajig is not in room 1." instead;
	otherwise:
		say "what an interesting error you've found examining the thingamajig!".
1 Like

If this works better for you, it definitely will get you where you’re going, but it can make some things more challenging – in particular, having all this repeated text can make it hard to edit and ensure consistency (NB you’ve got some inconsistent capitalization) – and regardless I’d probably do it as a carry out, not a check, rule, since IIRC if you’re bailing out of the check rule with "…instead"s, that means the action will never successfully complete which means conditions of the type “…if the thingamajig has ever been examined”, or the “[one of]…[stopping]” approach mentioned above, might not work as expected.

EDIT: Also I think you can simplify the rule by toggling if the location is room 1 – unless there’s some weird scope manipulation stuff happening where you can examine stuff that’s not in the same room as the player.

2 Likes

Certainly. If your description varies in a ridiculously complicated manner, you can also use substitutions.

The description of the white cube is "Gazing at the white cube here in [the location of the player], you notice [cubecolor]."

To say cubecolor:
    if the location is Green Room:
        say "it reflects a green hue";
    otherwise if the location is Red Room:
        say "it reflects a rather evil-looking red tint";
    otherwise:
        say "nothing special about it";

You can even defer an entire description with a substitution and nest them.

The description of the white cube is "[cubedesc]".

To say cubedesc:
     if the location is dangerous:
          say "The cube is in danger! ";
     end if;
     if the cube is bleeping:
          say "The cube is bleeping in fear! ";
    end if;
    say "It casts a [roomcolor] hue."
3 Likes

That did it! Thanks again.

1 Like

Yes to all that. I do most things by room, anyway, because it’s easy to fit into the volume… section schema. My initial testing seemed to distinguish enclosed items, which doubled the size :nauseated_face: That was likely my doing.

I think the biggest thing I’ll struggle with, a thousand words or so down the line, is just finding and reading what I need. I’m trying to make something I can read. Not now, but later.

2 Likes