Can't figure out why printed name won't change

Hello, all:

I had this entry in another topic, it was entitled “Honestly, I have no idea how to code this.” Using a bastardization of two responses but it compiles. Anyway, the code is constructed to randomly pick the printed name of a tarot card and two distractor cards. It will print the name of the tarot card correctly but not the two distractors. Instead of listening the three printed names, the room description says “Two of Wands, and two distractor cards.” I can’t figure out why the code isn’t also assigning the printed name of the distractor cards

The correct card is a tarot card that varies.

Definition:  A tarot card is incorrect if it is not the correct card.

a distractor is a kind of thing.

when play begins:
	assign the next correct card;

The distractor card is a distractor that varies.

tarotcard1 is a tarot card.  fortuneteller is carrying tarotcard1.
distractor01 is a distractor.  fortuneteller is carrying distractor01.
distractor02 is a distractor.  fortuneteller is carrying distractor02.

To assign the next correct card:
	let distractor1 be false;
	if distractor1 is false:
		choose a random row in Table of Distract;
		now usedyet entry is true;
		now distractor1 is true;
		now the printed name of distractor01 is Tarot card entry;
	let distractor2 be false;
	if distractor2 is false:
		choose a random row in Table of Distract;
		now usedyet entry is true;
		now distractor2 is true;
		now the printed name of distractor02 is Tarot card entry;
	let cardpicked be false;
	repeat through Table of Correct Tarot Cards:
		if cardpicked is false:
			now usedyet entry is true;
			now cardpicked is true;
			now the printed name of correct card is card entry;
			present a tarot challenge;
		if cardpicked is false:
			say "'That's all the correct cards, so I guess you win!'";
			end the story.

Table of Correct Tarot Cards
usedyet	card
false	"Two of Wands"
false	"Six of Pentacles"
false	"The Hanged Man"
false	"Five of cups"
false	"Eight of swords"

Table of Distract
usedyet	Tarot card
false	"Two of Wands"
false	"Six of Pentacles"
false	"The Hanged Man"
false	"Five of cups"
false	"Eight of swords"
false	"Six of swords"

I think you’re running into this issue:

Inform’s idea of “identical” is based on what the player could type in a command to distinguish things. In a few cases this can make items unexpectedly identical. For example:

The Lab is a room. A chemical is a kind of thing. 
Some polyethylene and polyethylene-terephthalate are chemicals in the Lab.

results surprisingly in “You can see two chemicals here”, because the run-time system truncates the words that are typed - POLYETHYLENE and POLYETHYLENE-TEREPHTHALATE look like the same word in a typed command. So Inform decides that these are indistinguishable chemicals. Typically words are truncated after 9 letters, though (unless the Glulx setting is used) punctuation inside a word, such as an apostrophe, can make this happen earlier. The best way to avoid trouble is simply to use more easily distinguishable names.

Cf. 4.14. Duplicates.

distractor01” and “distractor02” are too long, and thus indistinguishable in input, and thus treated as just “two distractors”. (Edited to elaborate: The printed names are assigned, but they won’t be used in the output when the items are treated as indistinguishable, since the objects will be grouped together when they are in the same place, for example both in the room, or both in the player’s inventory. You can see that the printed names have been assigned correctly by letting the player carry one of the distractors, and leaving the other in the room.)

Renaming them to something shorter, for example “dist01” and “dist02”, should get it working.

4 Likes

THank you for your help!

1 Like