[Home] [Downloads] [Search] [Help/forum]

Success and failure messages

When using locks it is good practice to put a "success" and "failure" message on the object being locked. This helps tell the player why (or when) s/he succeeded or failed to use the object. For example:


@lock east = +key
@succ east = You unlock the door and go through it.
@fail east = You must be carrying the key to go through this door.
@osucc east = unlocks the door and passes through.
@ofail east = tugs uselessly at the door.

Type of success and failure messages

There are six different type of message/actions you can put on a basic lock. They are:

  1. What you see if you pass the lock
  2. What you see if you fail the lock
  3. What others see if you pass the lock.
  4. What others see if you fail the lock

    These messages are usually preceded by "o" (for "others"), for example "@ofailure".

  5. An action that is taken if you pass the lock.
  6. An action that is taken if you fail the lock

    These messages are usually preceded by "a" (for "action"), for example "@afailure".

In detail, the commands to set these messages/actions are as follows.


Syntax

The general syntax is:


<command> <object> [ = <message> ]

or


<command> <object> [ = <actions> ]

<object> can be a thing, player, exit, or room, specified as:

If you do not specify an action or message then the action or message is cleared. For example:


@fail east

This would clear the @fail message on the east exit.


Messages/actions for the basic lock

Command Result
@success Displayed to the player when s/he successfully uses the object. Can be abbreviated to "@succ".
@failure Displayed to the player when s/he fails to use the object. Can be abbreviated to "@fail".
@osuccess The @osuccess message, prefixed by the player's name, is shown to others when the player successfully uses the object. Can be abbreviated to "@osucc".
@ofailure The @ofailure message, prefixed by the player's name, is shown to others when the player fails to use the object. Can be abbreviated to "@ofail".
@asuccess Sets the actions to be taken on successful usage of <object>. Actions are lists of commands separated by semi-colons and these commands are executed by the object. Things can execute almost any command but rooms and exits are restricted to forcing objects/puppets to do things. Gender substitutions are applied to the commands before they are executed, this allows use of the player's name who caused the action. It can be abbreviated "@asucc".
@afailure Sets the actions to be taken on failure to use <object>. Actions are lists of commands separated by semi-colons and these commands are executed by the object (see puppet). Things can execute almost any command but rooms and exits are restricted to forcing objects/puppets to do things. Gender substitutions are applied to the commands before they are executed, this allows use of the player's name who caused the action. May be abbreviated "@afail".

When @success messages (and their variants) are displayed

Type of thing When the message is displayed
Exits When someone walks through the exit
Objects When that object is picked up
Players When the player is picked up
Rooms When someone looks at it

Of course, @failure messages (and their variants) are displayed when someone fails to do one of the above.


Other types of messages and actions

Some other lock types also trigger messages and actions. These are:

Lock type Command Result
Drop @drop The message is displayed when a player drops <object>.
@odrop This message is shown to others when the player drops <object>.
@adrop Sets the actions to be taken when <object> is dropped.
Enter @enter The message is displayed to anyone entering the object.
@oenter This displays <name> <message> to everyone inside the object, except for the person who is entering.
@oxenter This replaces the functionality of the old @oenter. This message is shown to everyone in the room that the player leaves whenever he enters an object via the command 'enter <object>'. This will be shown in addition to the leave message of the room, not instead of.
@efailure This is the message shown to the player who fails to enter the object. May be abbreviated @efail.
@ofailure This is shown to others when the player fails to use <object>. May be abbreviated @ofail. (Note: @ofails on locked exits and objects is considered Good Building Practice.)
@aenter Executes <actionlist> whenever someone enters the object. Actions are lists of commands separated by semi-colons and these commands are executed by the object (see puppet). Objects can execute almost any command. Gender substitutions are applied to the commands before they are executed, which allows use of the player's name who caused the action.
@aefail This is the action taken by the object when a player fails to enter it.
Leave @leave The message is displayed to anyone leaving the object.
@lfail This is the message shown to the player who fails to leave the object.
@oleave This displays <name> <message> to others inside the object, except for the person who is leaving.
@olfail This message is shown to others in the room of a player who fails to leave the object.
@oxleave This message is shown to others in the room that a person enters when doing a 'leave' command. This will be shown in addition to the enter messages of the room, not instead of.
@aleave Executes <actionlist> whenever someone leaves the object. Actions are lists of commands separated by semi-colons and these commands are executed by the object. (see puppet). Objects can execute almost any command. Gender substitutions are are applied to the commands before they are executed, which allows use of the player's name who cause the action.
@alfail This is the action taken by the object when a player fails to leave it.
Page @haven This message is sent to a player whose pages you are refusing, either through use of the HAVEN flag or through the use of a page lock, if it evaluates to something non-null.
Teleport @tport The message shown to <object> when <object> is teleported.
@otport Sets the <message>, which will be prefixed by <object>'s name, that will be shown to the others in the room that the <object> is teleported to.
@oxtport Sets the <message>, which will be prefixed by <object>'s name, that will be shown to others in the room that the object has left via @teleport.
@atport Sets the list of actions that <object> will perform when it is teleported. These actions are done after <object> has arrived in its new location.
Use @use The message is displayed when a player successfully does a "use" on the object.
@ouse The @use message, prefixed by the player's name, is shown to others when a player successfully does a "use" on the object.
@ause Sets the actions to be taken when an object is succesfully "used". Actions are lists of commands separated by semi-colons.

Messages displayed even if no lock is present

You do not necessarily have to set a lock on an object to use some of the above messages. For example, the @use message or @success message can be used for unlocked objects, as an unlocked object always succeeds in the attempted action. For example:

@create wand
@use wand = You wave the wand, but nothing happens.
@ouse wand = waves %p wand, but nothing happens.
@success wand = You are now carrying the wand.
@drop wand = You have put the wand down.
@odrop wand = puts %p wand down.

The above messages will be shown when you use, take and drop the wand respectively.

The %p in the above messages will be replaced by "his/her/its" as applicable. See substitutions for more details.


Moving and copying attributes

If you wish to copy or move an attribute you can use @cpattr or @mvattr, as follows:

Syntax


@cpattr <obj>/<attr> = <obj1>[/<attr1>] [,<obj2>/<attr2>,<obj3>/<attr3>,...]
@mvattr <obj>/<attr> = <obj1>[/<attr1>] [,<obj2>/<attr2>,<obj3>/<attr3>,...]

Explanation

This command is used to copy <attr> on <obj> to the object-attribute pairs in a comma-separated list. For example:


@cpattr test/va = test/vb, cube/va, tribble/foo

would copy the VA attribute from object "test" to VB on "test", VA on "cube", and FOO on "tribble". <objN> is matched as if you were performing a @set on it.

If you leave out the destination attribute, the attribute is copied to one of the same name on the new object. For example:


@cpattr test/va=cube

would copy the VA attribute from "test" to VA on "cube".

@mvattr performs an @cpattr and then removes the original attrib.

Parenting

As an alternative to copying attributes you may find it easier to use @parent, to make an object automatically get its attributes from its parent.


Examining attributes

You can see an object's attributes by using "examine", for example:

ex wand

wand(#92n)
Type: Thing Flags: NO_COMMAND
Owner: Nick  Zone: *NOTHING*  Pennies: 1
Parent: *NOTHING*
Powers:
Warnings checked: none
Created: Sun Jul 27 13:12:56 1997
Last Modification: Sun Jul 27 13:15:10 1997
ODROP [#66$]: puts %p wand down.
OUSE [#66$]: waves %p wand, but nothing happens.
DROP [#66$]: You have put the wand down.
SUCCESS [#66$]: You are now carrying the wand.
USE [#66$]: You wave the wand, but nothing happens.
Home: Great Western Chasm(#88Rnt)
Location: Nick(#66PUeA)

You can see the ODROP, OUSE, DROP, SUCCESS and USE attributes in the list above.

Examining an individual attribute

To examine an individual attribute, append its name to the "examine" command separated by a slash. For example:

ex wand/succ

SUCCESS [#66$]: You are now carrying the wand.

[Previous] [Back] [Home]
Written by Nick Gammon - 5K

Comments to Gammon Software support

[Best viewed with any browser - 2K]    Internet Contents Rating Association (ICRA) - 2K    [Web site powered by FutureQuest.Net]

Page updated on Wednesday, 15 December 2004