mud++0.35/etc/
mud++0.35/etc/guilds/
mud++0.35/help/propert/
mud++0.35/mudC/
mud++0.35/player/
mud++0.35/src/interface/
mud++0.35/src/os/cygwin32/
mud++0.35/src/os/win32/
mud++0.35/src/os/win32/bcppbuilder/
mud++0.35/src/osaddon/
mud++0.35/src/util/
Triggers confusion:
There are two things which are called triggers now.
First is connected to Action class, and is partially implemented
for some time and second is spec_fun triggers which I implemented
for 0.18.

I will explain second variety of triggers.
There are three basic kinds of trigger owners: rooms, objects and mobs/npcs.
All of them inherit from common superclass - MUDObject.
Data for trigger for given instance is put into MUDObject part of class -
but it have different meaning for each type !
There are two fields:
- triggers - LList of <struct TriggerData>
- trigger_bits - bitfield for quick trigger/no-trigger checks

So, for object, if field trigger_bits have 4 bit set, it means
that this object have spec_fun responding to picking it up by somebody,
but the same bit in Char data would mean trigger for resolving reaction of
mob, when it is given object by somebody else.

Struct TriggerData consist of void * fun pointer, and int type field.
All spec functions have different parameters ! Exact typedef is in
trigs.h

To give an analogy - merc/envy spec_fun is represented by CTRIG_UPDATE
in this scheme.
All spec functions have to be registered in special file - trigchar.cc,
trigobj.cc or trigroom.cc

To make new functions you have to do 2 things:
- write spec_fun itself, with arguments fitting typedef in trigs.h
- add it to table called xxx_trigger_yyy where xxx is char/obj/room
and yyy is type of trigger.
You have also to provide ascii name for function.This name has to be one word 
(but_underline_pseudo_spaces_are_allowed), and has to be different from other 
names in this table. Every type of trigger has separate namespace. It would be 
also nice if ascii name would have something in common with C function name.
 
Here is quick reference for spec_funs, showing their current stage of
implementing and where you can find them. Class dispatch means that there
is TgXxxx method in class and source dispatch means that there are trigger
checks in crucial points.


                                class		source
                                dispatch	dispatch
#define CTRIG_CREATED       1	  +			  +(Room::repop)
#define CTRIG_UPDATE        2	  +			  +(NPCpulse)
#define CTRIG_GIVEN_GOLD    3	  +			  +(PC::do_give,Char::give)
#define CTRIG_GIVEN_OBJECT  4	  +			  +(Char::give)
#define CTRIG_TOLD          5	  +			  +(PC::do_tell)
#define CTRIG_ATTACKED      6	  +			  +(PC::do_kill)
#define CTRIG_HIT           7	  +			  +(Char::hit)
#define CTRIG_KILLED        8	  +			  +(Char::die)
#define CTRIG_SOCIALED      9	  +			  +(PC::command,PC::command(S&))
#define CTRIG_LOOKED_AT     10	  +			  +(PC::do_look)


#define OTRIG_CREATED       1	  +			  +(Room:repopx5) - check!
#define OTRIG_UPDATE        2	  +			  +(ObjPulse)
#define OTRIG_TIMER_OUT     3	  +			  +(ObjPulse) - watch out for objects.remove()
#define OTRIG_PICKED        4	  +			  +(Char::get(O), Char::get(O,O))
#define OTRIG_DROPPED       5	  +			  +(Char::drop,Char::put)
#define OTRIG_GIVEN         6	  +			  +(Char::give)
#define OTRIG_WORN          7	  +			  +(Char::wear,Char::wield)
#define OTRIG_REMOVED       8	  +			  +(Char::remove)
#define OTRIG_USED          9	  +			  +(Char::quaff x2,Char:eat)
#define OTRIG_LOOKED_AT     10	  +			  +(PC:look(O), PC::look(C))
#define OTRIG_ITEM_PUT_INTO	11	  +			  +(Char::put)
#define OTRIG_ITEM_GET_FROM 12	  +			  +(Char::get(O,O))




#define RTRIG_UPDATE        1	  +			  +(Room::repop)
#define RTRIG_DROPPED_ITEM  2	  +			  +(Char::drop)
#define RTRIG_PICKED_ITEM   3	  +			  +(Char::get(O))
#define RTRIG_STRANGE_CMD   4	  +  		  +(PC::command,PC::command(S&))
#define RTRIG_SAID_IN       5	  +  		  +(PC::do_say)
#define RTRIG_ENTERED       6	  +  		  +(Char::moveDir) - no chance to prevent?
#define RTRIG_LEFT          7	  +			  +(Char::moveDir)
#define RTRIG_SOCIALED_IN   8	  +  		  +(PC::command,PC::command(S&))





class Char
{
        bool TgCreated( Room * where, Repop * by );
        bool TgUpdate();
        bool TgGivenGold( Char * caller, int amount );
        bool TgGivenObject( Char * caller, Object * what );
        bool TgTold( Char * caller, char * what );
        bool TgTold( Char * caller, String & what );
        bool TgAttacked( Char * caller );
        bool TgHit( Char *who, /*damagetype or attack,*/ int amount );
        bool TgKilled( Char * killer /*,damagetype or attack*/ );
        bool TgSocialed( Char * caller, const Social * social );
        bool TgLookedAt( Char * caller );
}

class Object
{
        bool TgCreated( Room *where, Repop * by );
        bool TgUpdate();
        bool TgTimerOut();
        bool TgPicked( Char *caller, Room * from );
        bool TgDropped( Char *caller, Room * to );
        bool TgGiven( Char *from, Char * to );
        bool TgWorn( Char * caller );
        bool TgRemoved( Char * caller );
        bool TgUsed(Char * caller, MUDObject * target); // or Thing *
        bool TgUsed(Char * caller);
        bool TgLookedAt( Char * caller );
		bool TgItemPutInto( Char * caller, Object * what );
		bool TgItemGetFrom( Char * caller, Object * what );

}


class Room
{
        bool TgUpdate();
        bool TgDroppedItem( Char * caller, Object * what );
        bool TgPickedItem( Char * who, Object * what );
        bool TgStrangeCmd( Char * who, char * what );
        bool TgStrangeCmd( Char * who, String & what );
        bool TgSaidIn( Char * who, char * what );
        bool TgSaidIn( Char * who, String & what );
        bool TgEntered( Char * who, Room * from );
        bool TgLeft( Char * who, Room * to ); // exit to ?
        bool TgSocialedIn( Char * caller, const Social * social );
}

- put/get into/from container is quite unsure
- gold get/drop/put triggers are mostly non-exitent

Setting triggers in area files.

At the end of mob/object/room data just before ending '}' add
Trig { trigger_flag trigger_fun }
Where trigger flag is condition in which trigger have to fire up (check
trigbits.cc) and trigger_fun is specific function registered in one of the
tables in trig(char,obj,room).cc files.