[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/broadcaster.c

Basic sight and sound broadcaster.

Includes

This class includes the following files /include/clubs.h and /include/am_time.h

Method index

Public Functions

These are functions that everyone can access.

add_object_to_channel
void add_object_to_channel(string channel_name,
                           object ob)

This method adds an object to the list of objects to be told about the specfied channel. The method called on the object for the channel will be event_channel_message. The method will be called with three arguements, the first is the object generating the event the second is the channel the event is generated on and the third is the message being sent to the channel.

Parameters:
channel_name - the name of the channel
ob - the object to add to the list


broadcast_event
void broadcast_event(object * things,
                     int * centre,
                     string message,
                     int range,
                     int inside,
                     int underwater)

Sends an event out to all the things. It checks to make sure they can hear the event and all that stuff.

Parameters:
things - things that get told about it
centre - coords where event occurs
message - what the things get told
range - range of telling in room units
inside - tell things if indoors
underwater - tell things if underwater


broadcast_to_channel
void broadcast_to_channel(mixed ob,
                          string channel,
                          mixed message)

Inform channel of message. The message will get sent to all the objects added to the list to the method event_channel_message. The method will be called with three arguements, first is the object that started the event, the second the channel it is being send to and the last is the message being sent to the channel.

Parameters:
ob - the object creating the channel event
channel - the channel to inform people about
message - the message to tell the channel about


get_direc_dist
mixed * get_direc_dist(int * co_ord1,
                       int * co_ord2)

This method returns the square distance, the name of the direction the sound comes from and the up down offset. It is used by the shout code and by various other things that require this inofmraiont. The return array is formated as:
({ square_distance, name_of_direction, z_offset })

Parameters:
co_ord1 - the first co-ordinate
co_ord2 - the co-ordinate to compare against

Returns:
the array as described above


is_channel
int is_channel(string channel)

This method checks to see if the channel exists.

Parameters:
channel - the channel name to check for

Returns:
1 if the channel eixsts, 0 if not

See also:
query_channel_members()


npc_hear_shouts
void npc_hear_shouts(object newlistener)

Adds an NPC to the list of NPC's who are to receive shout events. The NPC need not be removed from this list when he dies -- desting the NPC object has the same effect as calling npc_unhear_shouts(). event_person_shout() is activated on the NPC for all shouts. NPC's do not normally detect shouts. event_person_shout() on the NPC should be replaced with similar code to that in the broadcaster to determine if the shouter is within range and to generate the desired response.

Parameters:
newlistener - NPC object to be added to the list

See also:
/global/events->event_person_shout() and npc_unhear_shouts()


npc_shout_event
void npc_shout_event(object shouter,
                     string start,
                     string message,
                     string lang,
                     int * coord,
                     int range)

This method is called by the shout command to filter the shouts onto the npcs that are listening.

Parameters:
shouter - the person who shouted
start - the start of the message
message - the message shouted
lang - the language the message is in
coord - the co-ordinate it was shouted from
range - the range of the shout


npc_unhear_shouts
int npc_unhear_shouts(object oldlistener)

Removes an NPC from the list of NPC's who are to receive shout events. The NPC need not be removed from this list when he dies -- desting the NPC object has the same effect as calling npc_unhear_shouts().

Parameters:
oldlistener - NPC object to be removed from the list

Returns:
1 if successfully removed

See also:
/global/events->event_person_shout() and npc_hear_shouts()


query_channel_history
mixed * query_channel_history(string channel)

This message returns the current history list for the channel. The array is:
({ ({ person, message }), ... })

Parameters:
channel - the channel to get the history of

Returns:
the history of the channel

See also:
broadcast_to_channel()


query_channel_members
object * query_channel_members(string channel)

This method must only be used for debugging purposes.

Parameters:
channel - the channel which has all these things on it

Returns:
the array of objects in the channel

See also:
is_channel()


query_next_channel_number
int query_next_channel_number(string channel)

This method keeps track of an ever increasing number for a specified channel type. THis is used in the wizards spell (for instance) to keep track of unique ids for wizard channels.

Parameters:
channel - the name of the channel

Returns:
the next number in the series


remove_object_from_channel
int remove_object_from_channel(string channel_name,
                               object ob)

This method removes an object from the list of objects to be told about the specified channel.

Parameters:
channel_name - the name of the channel
ob - the object to add to the channel