I’ve got a shapeshifter and I want to list the forms she can shift into. They’re all a type, so it’s as simple as “Available forms: [list of forms].” (with an “after” rule for the current form), like so:
Except that of course the current form prints as “yourself.” How do I make printing the name of the player actually print the name of the player in this case?
Try “[printed name of Whatever].”
Here is some code that does what you want:
[code]“Test” by Victor Gijsbers
Test chamber is a room.
Form is a kind of person.
The cat is a form.
The dog is a form.
The horse is a form.
Cat is in Test chamber.
When play begins:
change player to cat;
remove yourself from play.
let K be a list of indexed texts;
let x be an indexed text;
repeat with i running through forms:
now x is printed name of i;
if player is i:
now x is “[x] (current form)”;
add x to K;
say “These are the forms: [K].”.[/code]
I’d like to just write an Instead rule that replaces “name of the player” with “printed name of the player” in this context:
Instead of printing the name of the player while listing forms, say " ([printed name of the player])".
This works if I make it an After or Before rule, but it gives an error as an Instead rule. Why?
“Printing the name of something” is an activity, not an action so there aren’t any “instead” rules governing it. Activities only have “Before,” “For” and “After” rules (see ch. 17.3). You need a “For” rule followed by a colon:
For printing the name of the player while listing forms: say " ([printed name of the player])".