act()

act() description

Located in comm.cpp and called nearly 2,500 times in the codebase, this is one of the most used functions we have. It allows any other function to send output to the player or players in a room.

 

Called thus:

Sample Call
act("Your sdesc is: $n.", false, tch, 0, 0, TO_CHAR | _ACT_FORMAT);

 

Where $n is the sdesc of the character being targeted.

Here is the prototype:

Prototype
act (char *action_message, int hide_invisible, CHAR_DATA * ch,
OBJ_DATA * obj, void *vict_obj, int type)

 

The variables passed include:

* action_message - The message you want sent out.
* hide_invisible - If it's true, people that cannot see the ch will not see the message either.
* ch - Character, who this is being sent to.
* obj - What object is being targetted.
* vict_obj - an additional target or character
* type - an integer that's passed that defines exactly who sees this action

type is a single integer that uses bit-wise operators. The example above uses "TO_CHAR | _ACT_FORMAT" as the data to pass within that integer. Bits that can be assigned are located in structs.h, multiple bits can be assigned with the '|' (pipe) operator.

bit values
#define TO_ROOM ( 1 << 0 )
#define TO_VICT ( 1 << 1 )
#define TO_NOTVICT ( 1 << 2 )
#define TO_CHAR ( 1 << 3 )
#define _ACT_FORMAT ( 1 << 4 )
#define TO_IMMS ( 1 << 5 )
#define _ACT_COMBAT ( 1 << 6 )
#define TO_GROUP ( 1 << 7 )
#define _ACT_SEARCH ( 1 << 8 )
#define _ACT_BLEED ( 1 << 9 )
#define _HIGHLIGHT ( 1 << 10 )
#define _ACT_FIREFIGHT ( 1 << 11 )

 

 

Copyright 2015 Shadows of Isildur