Manual:DIL Manual/act()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 20:24, 17 January 2023 by Papi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

act()

The purpose of act is to send a message to a number of players present in a room. The room is defined as the room containing the aforementioned character (provided he himself is in the room, i.e. not in a closed container.)

Syntax:

 act(message, visibility, char, medium, victim, to_whom);

Parameters:

message: is a string that will be shown to other mobiles when the act is executed. To refer to the following arguments use the formatters listed below.

visibility: is an integer that defines what happens if the mobile that is about to receive the message can't see the activator.

  • A_SOMEONE

If the receiver cannot see char, replace any reference to char with someone.

  • A_HIDEINV

If the receiver cannot see char, don't send the message at all. Use this when missing vision should eliminate the perception of the action the message represent. One instance where it is used is in smile. You would need a ridiculously sensitive ear to hear, let alone percept that someone's smiling if you can't see them. Do not use it if 'sound' is inherent in the message.

  • A_ALWAYS

Works exactly like A_SOMEONE, except that the receiver will see the message even when sleeping.

char: is a unitptr, and the most important argument in the act. If this is not valid the act will never show, leaving mobiles without the message.

medium: is a unit pointer, an integer or a string. Use this at your leisure.

victim is a unit pointer, an integer or a string. Certain flags in the next argument rely on the validity of victim.

to_whom is an integer that defines who gets the message.

  • TO_ROOM

Sends the message to the entire room, excluding 'char'.

  • TO_VICT
                Sends to 'victim' only. 'victim' must be valid, naturally.
         TO_NOTVICT
                Sends the message to the entire room, excluding 'char' and 'victim'.  Perfect for bystanders in a melee.
         TO_CHAR
                Sends the message to 'char' and no one else.
         TO_ALL
                Sends the message to everybody in the room.
         TO_REST
                This is a bit different from the rest.  In sends the message to all other units in the local environment, excluding those inside 'char'.
---~---~---~---~---~---~---~---~---

Act Formatters
Just as the description formatters, act has its own set of formatters that
enable you to create generic messages that will be interpreted at run-time,
lessening the load on you.
The format string is a normal message, containing some special characters:
 '$$'
         will be sent to the receiver as a single `$'
'$', followed by a number and an extra character.
  The numbers:
 '1'
          means this formatter refers to the 'char' argument.
 '2'
         means this formatter refers to the 'medium' argument.
 '3'
          means this formatter refers to the 'victim' argument.
   The characters
 'N'
          the formatter will be replaced with the name of the unit, or (depending on the visibility) 'something' or 'someone'.
 'a'
         'a' or 'an' depending on the name of the unit referred by the number.
 'e'
         'it', 'he' or 'she' depending on the gender of the unit referred by the number.
 'm'
         'it', 'him' or 'her' depending on the gender of the unit referred by the number.
 'n'
          the formatter will be replaced with the title of the unit, or (depending on the visibility) 'something' or 'someone'.
 'p'
         'fighting', 'standing', 'sleeping', etc., depending on the positionof the unit referred by the number.
 's'
         'its', 'his' or 'her' depending on the gender of the unit referred by the number.
 't'
         the string in the argument referred by the number.


Example:

   act("You step over $2n.", A_SOMEONE, self, litter, null, TO_CHAR);
   act("$1n steps over $2n.", A_SOMEONE, self, litter, null, TO_REST);


See Also:
  DIL Act() for Dummies
---~---~---~---~---~---~---~---~---