Command reference

Register

Prog · admin

Command words: register
Permission: Admin

The register command is used to view and edit the 'register variables' that are associated with any prog type.

Register variables are ways for you to extend what information is stored on existing data types. For example, while a character might already have fields like their name, age, location and a list of inventory items, you could add a new variable (a register variable) to characters to store a number that represented their reputation with a faction.

All things of the same type share the same register variables, but each individual thing gets to track its own values. So all rooms might have a 'GangOwner' variable but each room would have its own value for that.

The syntax for setting up register variables is as follows:

register show <type> - shows all registered variables for a type
register remove <type> <variable name> - removes a variable from a type. Causes irreversible data loss.
register <type> <name> <variable type> - creates a new variable for a type
register default <type> <name> <value> - sets the default value for a register variable if none is otherwise set

To use these variables in your progs, you can use the following two snippets:

GetRegister(@thing, "variable name") - retrieves a register variable
SetRegister @thing "variable name" @value - sets a register variable. Note that this is a statement not a function.

To see a list of types, use prog help types.
To see what register values a room, item or character has use the sniff command.

← Back to Command reference