Help

JS-NAMES

For immortals Also: JAVASCRIPT-NAMES, JS-ADDRESS

Scripts can name rooms, creatures and objects by their address as well as by their number. An address is the zone's code, a dot and the thing's name: club.clubroom. A thing without a name is addressed by its number in its zone: club.28766. Numbers keep working exactly as before.

Where an address is taken:

Room.at( <room> )The room: Room.at( 'club.clubroom' )
Char.invoke( <creature>, <target>, ... )The creature: Char.invoke( 'club.xena', actor )
Obj.invoke( <object>, <target>, ... )The object: Obj.invoke( 'club.pebble-necklace', actor )
A target or room argumentWherever a room number is taken (an invoke's target, go() ...), a room's address is too: Obj.invoke( 4038, 'club.clubroom' )

The forms:

'club.clubroom'The thing named clubroom in zone club. An old name (kept when a thing is renamed) works too.
'club.28766'The thing with that number in zone club.
'.clubroom'The name in the script's own zone: the zone of the room, creature or object the script is on (for a player, the zone of the room the player is in).
28771, '28771'The number, as always.

A string that starts with a letter or a dot is an address; anything else is read as a number, as before. Addresses in scripts are exact: 'cellar' without its zone, a name that is not there, or one that is the wrong kind of thing stops the script with an error that says why and, when it can, which names you may have meant:

Room.at(): no room "club.bridge"; did you mean club.east-bridge or club.west-bridge?
Room.at(): "club.xena" is a creature, not a room.

Rooms, characters and objects also have:

idIts full address: 'club.clubroom', or 'club.28766' without a name. A creature and an object give their prototype's address. Empty for a player.
uidIts hidden id: a number that never changes, even when the thing is renamed or moves to another zone. Use it as a key in tables you keep. For things built before names it is the old number. null for a player.
zoneThe zone it belongs to, as a Zone object: the zone whose file holds it. null for a player.
zidThe code of that zone: 'club'. Empty for a player.
is( <address> )True if it is the thing the address names (an old name counts): if ( self.is( 'club.xena' ) ) .... A number works too. An address of another kind of thing gives false; one that names nothing is an error.

zone is not inZone: zone is the zone a thing belongs to, inZone the zone it is in right now. A creature of club that has wandered into moz has zone.id 'club' and inZone.id 'moz'. For a room the two are the same.

Zone objects have id, the zone's code ('club'), and uid, its number, which never changes.

vnum still gives the number. Players never see names or addresses.