Printing the name of the character

I’m trying to use the status line to keep track of what player you’re currently playing as.

I tried setting the status line to “[the player]”, but it just types, ‘Yourself’. Is there any way to go around this to the normal printed name of the character you are?

The “standard name printing rule” is a “rule for printing the name of”, written in I6. By default it has a special case for the player. But you could change that!

[code]Include (-
Global caps_mode = false;

[ STANDARD_NAME_PRINTING_R obj;
obj = parameter_value;
if (obj == 0) {
LIST_WRITER_INTERNAL_RM(‘Y’); return;
}
switch (metaclass(obj)) {
Routine: print "<routine ", obj, “>”; return;
String: print “<string ~”, (string) obj, “~>”; return;
nothing: print "<illegal object number ", obj, “>”; return;
}
! if (obj == player) {
! if (indef_mode == NULL && caps_mode) PRINT_PROTAGONIST_INTERNAL_RM(‘A’);
! else PRINT_PROTAGONIST_INTERNAL_RM(‘B’);
! return;
! }
#Ifdef LanguagePrintShortName;
if (LanguagePrintShortName(obj)) return;
#Endif; ! LanguagePrintShortName
if (indef_mode && obj.&short_name_indef ~= 0 &&
PrintOrRun(obj, short_name_indef, true) ~= 0) return;
if (caps_mode &&
obj.&cap_short_name ~= 0 && PrintOrRun(obj, cap_short_name, true) ~= 0) {
caps_mode = false;
return;
}
if (obj.&short_name ~= 0 && PrintOrRun(obj, short_name, true) ~= 0) return;
print (object) obj;
];
-) instead of “Standard Name Printing Rule” in “Printing.i6t”.[/code]

This will change all references to the player’s name.

If you only want to change it in one specific instance, you can use “[the printed name of the player]”, but that will circumvent any special “rules for printing the name”.

Finally, the best option that doesn’t involve I6 hacking even though it’s rather klugey:

[code]To zero the player: (- player = 0; -).
To reset the player: (- player = noun; -).

To say the/-- player’s name:
let the previous noun be the noun;
now the noun is the player;
zero the player; [“Now the player is nothing” will make Inform unhappy]
say “[the noun]”;
reset the player;
now the noun is the previous noun.[/code]

A global variable is the easiest way to make it accessible in I6, and the noun is a convenient variable to use.

You could write rules of the form:

Rule for printing the name of Teresa while constructing the status line: say "Teresa". 
Rule for printing the name of Maleska while constructing the status line: say "Maleska". 

one for each playable character. This is (a slight modification of) the recommendation from the documentation, in Example 121: Terror of the Sierra Madre.

That also. Or write a “rule for printing the name of the player while constructing the status line” that invokes the printed name property directly.

Thank you, this is all very helpful!