Creating Text from Text Tokens

(Outcast Orange) #1

I want to create some text based on some tokens, but I don’t want that text to update when the tokens change. Basically, can I treat a token as raw text somehow?

For example:

now the printed name of the apple is "[Heron]'s apple";
now the printed name of Heron is "Isaac";

I want the apple to remain as “Heron’s apple”, even if Heron is renamed.

My specific application today is items that can be repainted various colors, though I run into problems frequently that might be solved by de-tokenizing some text.

Something like:

now the printed name of the apple is "[Heron]'s apple" as text;

I swear I saw this covered in the handbook somewhere, probably near the beginning too.

0 Likes

(Outcast Orange) #2

I seem to have answered my own question.

From the handbook:

"substituted form of (text) … text"

This gives the text with substitutions immediately made.

2 Likes

(Hanon Ondricek) #3

Basically you just want
The printed name of the apple is "Heron's apple". Understand "heron's apple" as the apple.

The only time Inform prepends a possessive to an object automatically is if it is a kind that is universally assigned to every member another kind.

Test room is a room.

A nose is a kind of thing. One nose is part of every person.

John is a man in test room. Jane is a woman in test room.

Test room
You can see John and Jane here.

x nose
Which do you mean, your nose, John’s nose or Jane’s nose?

x jane’s nose
You see nothing special about Jane’s nose.

showme nose
Which do you mean, your nose, John’s nose or Jane’s nose?

john’s
John’s nose - nose
location: part of John in Test room
singular-named, proper-named; unlit, inedible, portable
list grouping key: none
printed name: “John’s nose”
printed plural name: “noses”
indefinite article: none
description: none
initial appearance: none

A handle is a kind of thing. One handle is part of every device.
an odd device is a device in test room. 

showme device
odd device - device
odd device’s handle (part of odd device) - handle

These should remain named no matter how absurdly manipulated in-game.

Instead of jumping:
	say "Got your nose!";
	now john's nose is held by the player;
	now jane's nose is held by the player.

Test room
You can see John and Jane here.

jump
Got your nose!

i
You are carrying:
Jane’s nose
John’s nose

0 Likes