Attributes are a set of qualities that an item either has or hasnt. An item can have none of the possible attributes, all of the possible attributes, or any combination in between. Initial attributes are given to an object in its definition using the keyword has (see the chapter Definitions in Detail), while they are given and taken away during the course of the game using the ensure command. Many of the attributes do not have any pre-determined purpose and may be used by the author at will. The best way to determine the full effect of any given attribute is to search for it in the verbs.library file.
The ensure command is used to change which attributes an item has and uses the following syntax:
ensure Item has/hasnt Attribute
There is nothing really tricky about the ensure command. You are either giving an item an attribute with a command like:
ensure dungeon has DARK
or taking an attribute away from an item with a command like:
ensure lantern hasnt LUMINOUS
Below is a list of the attributes that can be given to an object, and some brief notes on each.
Attribute | Description |
---|---|
CLOSED | If an object has the attribute CLOSED, its contents will not be accessible to the player. |
LOCKED | If an object has the attribute LOCKED, it cannot be opened or closed by the player. |
DEAD | An object that has the attribute DEAD must also have the attribute ANIMATE. A DEAD object may not be killed, talked to, shown things or given things. |
IGNITABLE | An object that has the attribute IGNITABLE may be used to light an object that has the object FLAMMABLE. |
WORN | An object that has the attribute WORN will not burden the player with its mass. In order to wear an object it must also have the attribute WEARABLE. While an object has the WORN attribute, the player will not be able to drop it or give it away. |
CONCEALING | An object that has the attribute CONCEALING must also have the attribute ANIMATE. This attribute indicates that when the object is examined, the objects that it is carrying should not be listed. |
LUMINOUS | When it is present, an object that has the attribute LUMINOUS will allow the player to enter a location that has the attribute DARK. |
WEARABLE | The player may wear an object that has the attribute WEARABLE. |
CLOSABLE | An object that has the attribute CLOSABLE may be opened and closed by the player. |
LOCKABLE | An object that has the attribute LOCKABLE may be locked and unlocked by the player. |
ANIMATE | An object that has the attribute ANIMATE may be killed, talked to, shown things or given things. |
LIQUID | An object that has the attribute LIQUID must be carried within an object that has the attribute CONTAINER and may be drunk or poured by the player. |
CONTAINER | An object that has the attribute CONTAINER may have other objects put inside it. If it also has CLOSABLE it must not have CLOSED for the player to put things in it. A container may hold as many mass units as its capacity element is set to. |
SURFACE | An object that has the attribute SURFACE may have things placed on top of it. A surface may hold as many mass units as its capacity element is set to. |
PLURAL | If an object is defined with a plural name, it should be given the attribute PLURAL so the library will avoid printing sentences such as "The boulders is too heavy to go throwing around." |
FLAMMABLE | An object that has the attribute FLAMMABLE may be lit using an object that has the attribute IGNITABLE. |
BURNING | When an object that has the attribute FLAMMABLE is lit, it will be given the attributes BURNING and LUMINOUS. |
ON | Free for use by the author. |
DAMAGED | Free for use by the author. |
FEMALE | This attribute should be given to any object that has the attribute ANIMATE and represents a female character. This will enable the library to refer to the character correctly. |
POSSESSIVE | If an object has the attributes ANIMATE and POSSESSIVE the player will not be able to take objects from them or ask them for objects unless specifically coded for. |
OUT_OF_REACH | An object that has the attribute OUT_OF_REACH cannot be touched, even when it is in the same location as the player. |
TOUCHED | An object that has the attribute TOUCHED has been moved from its starting position by the player. If the object's long property is set to function, this attribute can be tested to give an appropriate description. |
SCORED | Free for use by the author. |
SITTING | If the player is currently sitting, this attribute should be given, as the function +movement will check if it is set before moving the player. |
NO_TAB | This attribute indicates that the object's names should not be included during tab completion. Tab completion is only used by the console interpreter. |
NOT_IMPORTANT | This attribute is given to an object that is of no consequence game. It is usually used to implement nouns that are referred to in a location description but are not part of the game world the player needs to interact with. Verbs in the library will respond with You don't need to worry about that. when the player attempts to interact with an object that has this attribute. |
Below is a list of the attributes that can be given to a location, and some brief notes on each.
Attribute | Description |
---|---|
VISITED MAPPED |
When the player enters a location, it is automatically given the attributes VISITED and MAPPED after the lookfunction is run. These attributes may be tested for to provide a shorter description on subsequent visits. When the JACL interpreter is set to verbose mode (the DISPLAY_MODE variable is set to 1), locations will have the attribute VISITED taken away from them before the look function is executed. |
DARK | If a location has the attribute DARK, the player must be carrying an object that has the attribute LUMINOUS in order to enter it. |
DARKNESS | If the player's current location has the attribute DARK and no object with the attribute LUMINOUS is present, the location will be given the attribute DARKNESS and the player will be prevented from performing any actions that require the ability to see. You should never manually give or take the attribute DARKNESS to or from a location, only the attribute DARK. |
ON_WATER | If a location has the attribute ON_WATER, any object dropped will sink out of sight and end up in limbo. |
UNDER_WATER | If a location has the attribute UNDER_WATER, nothing may be lit, exposed liquids will dissipate and no talking is possible. |
WITHOUT_AIR | If a location has the attribute WITHOUT_AIR, the OXYGEN_LEFT variable will be decremented each turn until it reaches zero and suffocation occurs. |
OUTDOORS | If a location has the attribute OUTDOORS, any desired effects of weather should be applied. |
MID_AIR | If a location has the attribute MID_AIR, any object dropped will fall out of sight and end up in limbo. Actions such as jumping will not be allowed either. |
MID_WATER | If a location has the attribute MID_WATER any object dropped will sink out of sight and end up in limbo. |
TIGHT_ROPE | If a location has the attribute TIGHT_ROPE, any object dropped will fall out of sight and end up in limbo. |
POLLUTED | Free for use by the author. |
SOLVED | Free for use by the author. |
LOCATION | All locations have the attribute LOCATION. If this is taken away the location will become an object. |
SCORED | Free for use by the author. |
NO_TAB | This attribute indicates that the location's names should not be included during tab completion. Tab completion is only used by the console interpreter. |
NOT_IMPORTANT | This attribute is given to a location that is of no consequence game. It is usually used to implement nouns that are referred to in a location description but are not part of the game world the player needs to interact with. Verbs in the library will respond with You don't need to worry about that. when the player attempts to interact with an object that has this attribute. |
A common use of attributes is to check if an action has already been performed. This may be useful if it is not logically possible to perform the action twice, or each subsequent attempt would result in a different outcome. Another possibility is that you would like to give a lengthy response the first time, then a short response on all subsequent times. To help facilitate this, and many other types of game-specific behaviour, JACL allows you to define up to 32 user attributes. User attributes are defined using the attribute directive followed by one or more attribute names. Below is a rather minimal example of using user attributes:
attribute DOOR_OPENED {open_override ensure door hasnt CLOSED if door hasnt DOOR_OPENED write "You hold your breath as the door slowly " write "creaks open.^" ensure door has DOOR_OPENED return endif write "You open the door again.^" }
The above code creates a user attributes called DOOR_OPENED and gives the object door that attribute when it is first opened. It also tests whether the door already has this attribute before deciding which message to display.