As I am currently writing an Inform 7 programme that relies heavily on an older extension, I need help with an outdated Inform 7 version (6G60).
I would like to able to rename persons by the player. The new name should then appear as ‘printed name’ and be understood by the compiler (‘Understand … as …’).
I have tried several approaches so far:
‘naming is an action applying to one topic’: The problem here is that topic is an indexed text, but printed name requires a text. I can’t find a way to typecast an indexed text.
‘After reading a command: …’ Again, the command (‘current action’) is a snippet that I cannot convert to text.
Even comparing each individual letter of the Indexed Text variable with the ABC and appending it to a Text variable if they match fails, as Text does not have a concatenation function (as far as I know).
Does anyone remember these problems well enough to give me a hint (or knows a source code/extension that handled the problem).
I think the “Fido” example can give you some ideas on how you can proceed. Here’s the entire code from the 6G60 version:
Summary
"Fido"
The Back Yard is a room.
A dog is an animal in Back Yard. The dog has some indexed text called the nickname. The nickname of the dog is "nothing". Understand the nickname property as describing the dog.
Rule for printing the name of the dog when the nickname of the dog is not "nothing":
say "[nickname of the dog]"
Naming it with is an action applying to one thing and one topic. Understand "name [something] [text]" as naming it with. Check naming it with: say "You can't name that."
Instead of naming the dog with "nothing":
now the nickname of the dog is "nothing";
now the dog is improper-named;
say "You revoke your choice of dog-name."
Instead of naming the dog with something:
let N be indexed text; let N be "[the topic understood]";
replace the text "'" in N with "";
now the nickname of the dog is "[N]";
now the dog is proper-named;
say "The dog is now known as [nickname of the dog]."
Test me with "name the dog Fido / name the dog Lawrence / look / x lawrence / name Lawrence nothing / look / x lawrence".
A person has an indexed text called the name override.
When play begins:
repeat with the subject running through people:
now the name override of the subject is "[printed name of the subject]";
now the printed name of the subject is "[name override]".
This will convert "[printed name of the subject]" to an indexed text (i.e. a string), and then set the printed name itself to a pointer to that string.
Thanks for the two solutions. I didn’t even think I could solve the problem this way. Both solutions work perfectly in version 6G60. However, I have now realised that the language extension I use works massively with the Printed Name property and causes problems with both solutions. Theoretically, I would have to change the extension accordingly.