I’d like to be able to compare two text strings and see if they print the same thing, like this:
Use the serial comma.
Language Lab is a room.
A thing has some text called the plain name. The plain name of a thing is usually “[the printed name of item described]”.
A thing has some text called the florid name. The florid name of a thing is usually “[the printed name of item described]”.
Florid mode is a truth state that varies. Florid mode is false.
Floridifying is an action applying to nothing. Understand “florid” as floridifying.
Check floridifying when florid mode is true: say “We’re already in florid mode.” instead.
Carry out floridifying:
now florid mode is true.
repeat with item running through things:
if the florid name of the item is not the plain name of the item:
say “We will now refer to [the plain name of the item] as [the florid name of the item].”
The unremarkable potato is in Language Lab. The beet is in Language Lab. The florid name of the beet is “remarkable crimson-hued chenopodiaceous root”. The incredibly boring rock is in Language Lab. The plain name of the incredibly boring rock is “rock”. The florid name of the incredibly boring rock is “rock”.
For printing the name of a thing:
if florid mode is true:
say “[florid name of the item described]”;
say “[plain name of the item described]”.
Test me with “florid”.[/code]
But as the test shows, “florid name of the item is not the plain name of the item” only comes out true when the names are literal strings (as for the rock), not when they include text substitutions – even if they’re the same text substitution (as for the potato and yourself).
Is there a workaround for this other than casting everything into indexed text and comparing it? Would the indexed text comparisons be prohibitively computationally expensive if I had to do them, say, ten times a turn? Ten times a turn combined with a lot of crazy list operations?
(The code I’ve posted has a lot of other problems – the articles don’t work, for one – but I’m actually shooting for another application where the text comparison problem is the one that really matters.)