Ability: name

Description:

This ability is used for objects which can be referenced. Each object has a name and a set of aliases. The function id() determines whether a given string describes the object. This is used to recognize which object a player is talking about (e.g. in a command take red hat).

In practice you will never need to inherit this, because the object class has this ability.

Usage:

#include <ability.h>

inherit NAME;

Functions:

string query_name()
Return the name of the object.

string query_capname()
Return capitalized name of the object. Note that player names are already capitalized, so you can just call query_name() instead.

void set_name(string n)
Set the name of the object to n.

string query_alias()
Return the list of aliases for this object. The aliases are in lower case, even if they were set differently. Aliases do not include the name.

void set_alias(string *a)
Set aliases for this object to the list a. Any previous aliases will be forgotten. The aliases will be converted to lower case letters.

void add_alias(string a)
Add alias a to the list of aliases.

void delete_alias(string a)
Delete alias a from the list of aliases.

int id(string s)
Return 1 if string s is either the name of the object or an alias. All comparisions are case insensitive. Return 0 otherwise.

Source code:

/ability/name.c.

See also: