Manual:DIL Manual/name
Jump to navigation
Jump to search
Contents
name
Field (string, read-only; units: all; also on extraptr, zoneptr and cmdptr).
u.name : string e.name : string z.name : string c.name : string
- unitptr: the first of the unit's names. For a player that is the player's name, which is also what
$1nin act() shows for a player (other units show their title). - extraptr: the first name (keyword) of the extra description.
- zoneptr: the zone's name, as in
sym@zone. - cmdptr: the command's full name, such as
"wiz".
Notes
- It can't be assigned (vmc: "Illegal lvalue"). To rename a unit or an extra, change the first entry of names.
- A unit or extra without names gives
"". - On null it fails.
nameis a reserved word: it can't be a variable name. Usepnameor similar.
Example
dilbegin greet_pc();
var
pc : unitptr;
code
{
heartbeat := PULSE_SEC * 4;
:start:
wait(SFB_DONE, command(CMD_AUTO_ENTER) and (activator.type == UNIT_ST_PC));
pc := activator;
exec("say Greetings, " + pc.name + ".", self);
goto start;
}
dilend
An NPC greets each player who walks in, by name.