Files
grenzland-mud/src/dg_scripts.h
Rumble ebc985f010 jeremyosborne | 2008-04-04 02:36:38 +0200 (Fri, 04 Apr 2008) | 1 line
Minor Bugfix: All game configuration settings now reference the world config 
structure, not the individual config variables found in config.c.
------------------------------------------------------------------------
 rumble | 2008-03-22 13:27:00 +0100 (Sat, 22 Mar 2008) | 1 line

Added lib/world/qst/ directory, index, index.mini, and 0.qst.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-08 03:27:51 +0100 (Sat, 08 Mar 2008) | 3 lines

Bugfix: the include directory (for .h files) is now referenced correctly in the
depend statement.
Deletion: listrent.c removed as a separate utility.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-08 03:08:51 +0100 (Sat, 08 Mar 2008) | 1 line

Enhancement: utils/ Makefile will now use a depends file, and looks for dependen
cies in the ../ directory (shrinks the necessary information to make each utilit
y).
------------------------------------------------------------------------
 Rumble | 2008-03-06 23:39:35 +0100 (Thu, 06 Mar 2008) | 1 line

Made TBA specific changes. do_cheat, removed help level checking, and advance to
level 32.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 18:37:12 +0100 (Thu, 06 Mar 2008) | 1 line

Minor Update: Changed header of Makefile.in to read 'tbaMUD' and also added in a
ttribution for the changes. (Thanks seqwith.)
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 18:31:07 +0100 (Thu, 06 Mar 2008) | 4 lines

Changed Makefile.in to use glob expressions when building the objects. This 
translates into no longer a need to update Makefile.in whenever a new .c file 
is added to the mud code. Other Makefile.* have not yet been changed (and 
need review, anyway).

All CXREF cruft left in Makefile.in has been removed. tbaMUD is now using 
Doxygen. Technically, CXREF provides a bit more auto-documentation than Doxygen
does, however the tbaMUD (and legacy circle code) has never been marked-up with 
the special CXREF codes required to effectively use the program. Since Doxygen 
is easier to use, and provides almost as much functionality as CXREF, CXREF 
support has been dropped.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 08:31:02 +0100 (Thu, 06 Mar 2008) | 1 line

Bug Fix: asciiflag_conv* functions now can handle a negative numeric value.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 08:16:06 +0100 (Thu, 06 Mar 2008) | 1 line

Bug fix/enhancement: Charmed mobs (specifically charmed mobs with a ->master) 
will no longer attempt to wander off.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-06 08:13:38 +0100 (Thu, 06 Mar 2008) | 6 lines

Based on the compiler warning about mag_materials being an unused function, and
the clone spell being unused.

Bug fix: Clone can now be cast. It is an 'ignore' target spell.

Fix and Modification: Clone, being an effectively unused spell that is only used
by mortal Magic Users at level 30, is now implemented as very simple example of
how to use mag_materials(). The item required by mag_materials is vnum 161, 
which in stock tbaMUD is some sacrificial entrails.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-05 01:43:09 +0100 (Wed, 05 Mar 2008) | 3 lines

Bug Fix for "Did you mean:" including DG commands.
------------------------------------------------------------------------
 jeremyosborne | 2008-03-05 01:29:18 +0100 (Wed, 05 Mar 2008) | 3 lines

Bug Fix: do_simple_move slightly rewritten to handle Leave triggers that purge a
 door.

Documentation: do_simple_move documented.
------------------------------------------------------------------------
 Laoris | 2008-03-01 08:22:12 +0100 (Sat, 01 Mar 2008) | 1 line

Trial run of columnizer function on commands list to see how people like it.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-26 22:36:17 +0100 (Tue, 26 Feb 2008) | 1 line

asciimap, an in game automap, along with a couple of minor bug fixes to do with
the automap, patched in (Thanks Jamdog).
------------------------------------------------------------------------
 jeremyosborne | 2008-02-22 04:08:05 +0100 (Fri, 22 Feb 2008) | 1 line

Minor update: Relocate local variable declaration to the top of ACMD(do_help)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-22 04:04:37 +0100 (Fri, 22 Feb 2008) | 6 lines

Checked in the following placeholders for do_gen_tog:
#define SCMD_AUTOLOOT   24
#define SCMD_AUTOGOLD   25
#define SCMD_AUTOSPLIT  26
#define SCMD_AUTOSAC    27
#define SCMD_AUTOASSIST 28
------------------------------------------------------------------------
 jeremyosborne | 2008-02-22 03:57:06 +0100 (Fri, 22 Feb 2008) | 1 line

The Autoquest patch, along with a couple of minor bug fixes, has been integrated
into tbaMUD. (Thanks Jamdog, Kenneth Ray and Morgaelin.)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 21:46:45 +0100 (Mon, 18 Feb 2008) | 2 lines

Minor Fix:
Casted NOWHERE, NOTHING, NOBODY and NOFLAG as IDXTYPE for the signed short int 
index types.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 03:36:16 +0100 (Mon, 18 Feb 2008) | 7 lines

Added a new atoidx() conversion function for dealing with string to IDXTYPE 
conversions (in utils.c, prototype exported through utils.h).
Added IDXTYPE_MIN and IDXTYPE_MAX defines (in structs.h).
Replaced atoi references with atoidx in do_oasis_zedit (in zedit.c).
------------------------------------------------------------------------
 Rumble | 2008-02-18 01:44:13 +0100 (Mon, 18 Feb 2008) | 1 line

Fixed direction mapping to give readable directions instead of sub commands. 
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 00:26:15 +0100 (Mon, 18 Feb 2008) | 5 lines

Since general olc editing are automatically saved to disk, 'shutdown reboot' has
been changed to not-autosave by default. (Small change made to do_shutdown in 
act.wizard.c).
------------------------------------------------------------------------
 jeremyosborne | 2008-02-18 00:12:12 +0100 (Mon, 18 Feb 2008) | 3 lines

Changed:
struct attack_hit_type moved to fight.h
attack_hit_text exported through fight.h
------------------------------------------------------------------------
 jeremyosborne | 2008-02-17 22:32:51 +0100 (Sun, 17 Feb 2008) | 7 lines

- do_file heads or tails files correctly and has also been enhanced to return 
file info (act.wizard.c)
- defines made for common log files created by autorun, and those used by 
do_file (db.h)
- utility functions added: file_head(), file_tail(), file_sizeof(), and 
file_numlines() (defined utils.c and exported through utils.h)
------------------------------------------------------------------------
 Rumble | 2008-02-16 23:24:05 +0100 (Sat, 16 Feb 2008) | 1 line

Fixed export command. (thanks Kyle)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-16 22:42:46 +0100 (Sat, 16 Feb 2008) | 1 line

Files are now tagged as executable. Should be able to be checked out from subver
sion and executed without running chmod.
------------------------------------------------------------------------
 Rumble | 2008-02-15 17:03:06 +0100 (Fri, 15 Feb 2008) | 1 line

 Fixed strcat() writing out of bounds in cedit.c since strdup() only malloc() 
strlen(str)+1 bytes. (thanks Buggo) and moved attack_hit_text back.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-13 20:41:02 +0100 (Wed, 13 Feb 2008) | 1 line

Event queue function definitions, global variables and defines doxygenated.
------------------------------------------------------------------------
 Rumble | 2008-02-12 00:23:38 +0100 (Tue, 12 Feb 2008) | 1 line

Updated levels command to use an arg/range and added color parsing to greetings.
 (thanks Jamdog)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-11 21:06:10 +0100 (Mon, 11 Feb 2008) | 1 line

Doxygen comments completed for weather.c
------------------------------------------------------------------------
 Rumble | 2008-02-11 03:52:50 +0100 (Mon, 11 Feb 2008) | 1 line

Corrected several 64-bit warnings. (thanks Buggo)
------------------------------------------------------------------------
 Rumble | 2008-02-10 22:56:56 +0100 (Sun, 10 Feb 2008) | 1 line

Added get_flag_by_name allowing for new trigedit variable checks like 
%actor.pref(FLAG)% checks. (thanks Jamdog)
------------------------------------------------------------------------
 jeremyosborne | 2008-02-08 21:22:26 +0100 (Fri, 08 Feb 2008) | 3 lines

COMPLETE: tbaMUD code re-org of global and local scope function and variable 
declarations. There may be a few things that I did not catch (some non extern 
keyword declarations of function prototypes within other functions, for 
example).

BUG FIX: Unused functions encrypt_hex() and decrypt_hex() removed from mail.c.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-05 23:31:09 +0100 (Tue, 05 Feb 2008) | 2 lines

Continued clean-up of 'extern' references to functions and variables.
BUG UNCOVERED: set_title() in class.c incorrectly handles the const nature of 
the char * returned from title_female and title_male.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-05 19:38:17 +0100 (Tue, 05 Feb 2008) | 3 lines

More work on mud clean-up.
New file: spec_procs.h
Created this file to house the legacy special procedures (spec_procs.c and 
castle.c) and special feature assignment in general.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-05 00:59:44 +0100 (Tue, 05 Feb 2008) | 3 lines

- Minor Bugfix: Fixed parse error in mobact.c
- Minor Bugfix: act.h is now included in all of the act functions. Forgot to do
that the first time :(
- Additions: ban.h has been added as the external entry point into the ban.c 
globals and functions. Files needing ban.h have been updated.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-04 20:02:11 +0100 (Mon, 04 Feb 2008) | 1 line

All act*.c functions, defines and globals have been prototyped/declared in 
act.h. The file act.h does not contain every ACMD, only those ACMDs and 
utility functions available within the act*.c files.
------------------------------------------------------------------------
 Rumble | 2008-02-04 17:59:47 +0100 (Mon, 04 Feb 2008) | 1 line

Fixed the last few flags missed for the 128 bit conversion.
------------------------------------------------------------------------
 Laoris | 2008-02-04 07:27:56 +0100 (Mon, 04 Feb 2008) | 3 lines

Adding a column formatter for lists.  Accepts printf-like arguments.
Only used by medit right now.

------------------------------------------------------------------------
 jeremyosborne | 2008-02-04 07:09:19 +0100 (Mon, 04 Feb 2008) | 2 lines

- Changed the 'struct queue' to 'struct dg_queue' to avoid namespace conflicts.
- Ongoing cleanup to mud project.
------------------------------------------------------------------------
 Rumble | 2008-02-04 00:07:09 +0100 (Mon, 04 Feb 2008) | 1 line

Fixed run_autowiz which ran twice on advancement.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-03 03:46:22 +0100 (Sun, 03 Feb 2008) | 1 line

act.h created and added. This header will be the external entry point for the 
functions, function subcommands and variables within the act*.c files. It is 
not designed to be the entry point for all ACMD functions.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-03 02:44:29 +0100 (Sun, 03 Feb 2008) | 1 line

Merge of another part of the code cleanup, the dg script stuff.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-02 08:56:03 +0100 (Sat, 02 Feb 2008) | 1 line

Modularizing and organizing files continues. Committing comm.c and comm.h 
because they are hairy, and I don't want to do them over if my hard drive 
crashes.
------------------------------------------------------------------------
 jeremyosborne | 2008-02-02 07:05:08 +0100 (Sat, 02 Feb 2008) | 4 lines

- Marking all file scope functions as 'static'
- Reorganization of the global variables and functions.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 10:20:47 +0100 (Thu, 31 Jan 2008) | 1 line

* Protected the conf.h.* system config files from multiple calls.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 09:56:18 +0100 (Thu, 31 Jan 2008) | 1 line

* Removed extraneous references to TRUE / FALSE and YES / NO defines.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 09:46:20 +0100 (Thu, 31 Jan 2008) | 2 lines

* BUGFIX: NUM_POSITIONS set to 8 (was incorrectly set to 15 before)
* Migrated NUM_* settings from oasis.h to more appropriate locations near where
they are defined. (For Example: NUM_POSITIONS moved to structs.h next to the 
POSITION_* defines.)
------------------------------------------------------------------------
 jeremyosborne | 2008-01-31 03:58:28 +0100 (Thu, 31 Jan 2008) | 1 line

Added Appendix A - Coder Support. Right now, it simply speaks to the fact that 
we have included doxygen config files, are working to document the source code, 
and provides a rudimentary "do this" guide to create the doxygen cross 
references.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-30 07:12:07 +0100 (Wed, 30 Jan 2008) | 2 lines

- All .h files now have doxygen recognized headers, and the format is slightly 
altered to ease editing of headers.
- Protected all .h files from multiple calls. (Standard format is #ifndef _HEADE
R_H_ #define _HEADER_H_ .... #endif)
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 11:18:14 +0100 (Tue, 29 Jan 2008) | 1 line

constants.h, structs.h and utils.h now protected from multiple includes. This is
 sometimes overkill, but good practice overall.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 10:38:18 +0100 (Tue, 29 Jan 2008) | 1 line

Updated documentation for constants.c and constants.h.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 10:15:25 +0100 (Tue, 29 Jan 2008) | 3 lines

The standard Doxygen configuration doxyfiles (config files) for tbaMUD. One is 
to be used with the Graphviz DOT (dox_withGraphs), one is designed to be used if
Graphviz is not available.

Now just need a short document describing the usage of doxygen.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-29 10:11:36 +0100 (Tue, 29 Jan 2008) | 1 line

Minor document correction in struct dex_app_tpe.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-28 20:53:51 +0100 (Mon, 28 Jan 2008) | 1 line

*bugfix* do_drink command: When a container is empty, the correct, "It is 
empty." message is now displayed.
------------------------------------------------------------------------
 jeremyosborne | 2008-01-28 07:58:15 +0100 (Mon, 28 Jan 2008) | 3 lines

Merging changes to trunk for:
* utils.h, utils.c and structs.h doxygen comments
* adding file dox_withGraphs.doxyfile
2008-04-12 01:31:58 +00:00

442 lines
18 KiB
C

/**
* @file dg_scripts.h
* Header file for script structures, constants, and function prototypes for
* dg_scripts.c
*
* Part of the core tbaMUD source code distribution, which is a derivative
* of, and continuation of, CircleMUD.
*
* This source code, which was not part of the CircleMUD legacy code,
* was created by the following people:
* $Author: Mark A. Heilpern/egreen/Welcor $
* $Date: 2004/10/11 12:07:00$
* $Revision: 1.0.14 $
*/
#ifndef _DG_SCRIPTS_H_
#define _DG_SCRIPTS_H_
#include "utils.h" /* To make sure ACMD is defined */
#define DG_SCRIPT_VERSION "DG Scripts 1.0.14"
#define MOB_TRIGGER 0
#define OBJ_TRIGGER 1
#define WLD_TRIGGER 2
/* unless you change this, Puff casts all your dg spells */
#define DG_CASTER_PROXY 1
/* spells cast by objects and rooms use this level */
#define DG_SPELL_LEVEL 25
/* Define this if you don't want wear/remove triggers to fire when a player
* is saved. */
#define NO_EXTRANEOUS_TRIGGERS
/* %actor.room% behaviour :
* Until pl 7 %actor.room% returned a room vnum. Working with this number in
* scripts was unnecessarily hard, especially in those situations one needed
* the id of the room, the items in it, etc. As a result of this, the output
* has been changed (as of pl 8) to a room variable.i This means old scripts
* will need a minor adjustment;
*
* Before:
* if %actor.room%==3001
* %echo% You are at the main temple.
*
* After:
* eval room %actor.room%
* if %room.vnum%==3001
* %echo% You are at the main temple.
*
* If you wish to continue using the old style, comment out the line below.
* - Welcor */
#define ACTOR_ROOM_IS_UID 1
/* mob trigger types */
#define MTRIG_GLOBAL (1 << 0) /* check even if zone empty */
#define MTRIG_RANDOM (1 << 1) /* checked randomly */
#define MTRIG_COMMAND (1 << 2) /* character types a command */
#define MTRIG_SPEECH (1 << 3) /* a char says a word/phrase */
#define MTRIG_ACT (1 << 4) /* word or phrase sent to act */
#define MTRIG_DEATH (1 << 5) /* character dies */
#define MTRIG_GREET (1 << 6) /* something enters room seen */
#define MTRIG_GREET_ALL (1 << 7) /* anything enters room */
#define MTRIG_ENTRY (1 << 8) /* the mob enters a room */
#define MTRIG_RECEIVE (1 << 9) /* character is given obj */
#define MTRIG_FIGHT (1 << 10) /* each pulse while fighting */
#define MTRIG_HITPRCNT (1 << 11) /* fighting and below some hp */
#define MTRIG_BRIBE (1 << 12) /* coins are given to mob */
#define MTRIG_LOAD (1 << 13) /* the mob is loaded */
#define MTRIG_MEMORY (1 << 14) /* mob see's someone remembered */
#define MTRIG_CAST (1 << 15) /* mob targetted by spell */
#define MTRIG_LEAVE (1 << 16) /* someone leaves room seen */
#define MTRIG_DOOR (1 << 17) /* door manipulated in room */
#define MTRIG_TIME (1 << 19) /* trigger based on game hour */
/* obj trigger types */
#define OTRIG_GLOBAL (1 << 0) /* unused */
#define OTRIG_RANDOM (1 << 1) /* checked randomly */
#define OTRIG_COMMAND (1 << 2) /* character types a command */
#define OTRIG_TIMER (1 << 5) /* item's timer expires */
#define OTRIG_GET (1 << 6) /* item is picked up */
#define OTRIG_DROP (1 << 7) /* character trys to drop obj */
#define OTRIG_GIVE (1 << 8) /* character trys to give obj */
#define OTRIG_WEAR (1 << 9) /* character trys to wear obj */
#define OTRIG_REMOVE (1 << 11) /* character trys to remove obj */
#define OTRIG_LOAD (1 << 13) /* the object is loaded */
#define OTRIG_CAST (1 << 15) /* object targetted by spell */
#define OTRIG_LEAVE (1 << 16) /* someone leaves room seen */
#define OTRIG_CONSUME (1 << 18) /* char tries to eat/drink obj */
#define OTRIG_TIME (1 << 19) /* trigger based on game hour */
/* wld trigger types */
#define WTRIG_GLOBAL (1 << 0) /* check even if zone empty */
#define WTRIG_RANDOM (1 << 1) /* checked randomly */
#define WTRIG_COMMAND (1 << 2) /* character types a command */
#define WTRIG_SPEECH (1 << 3) /* a char says word/phrase */
#define WTRIG_RESET (1 << 5) /* zone has been reset */
#define WTRIG_ENTER (1 << 6) /* character enters room */
#define WTRIG_DROP (1 << 7) /* something dropped in room */
#define WTRIG_CAST (1 << 15) /* spell cast in room */
#define WTRIG_LEAVE (1 << 16) /* character leaves the room */
#define WTRIG_DOOR (1 << 17) /* door manipulated in room */
#define WTRIG_TIME (1 << 19) /* trigger based on game hour */
/* obj command trigger types */
#define OCMD_EQUIP (1 << 0) /* obj must be in char's equip */
#define OCMD_INVEN (1 << 1) /* obj must be in char's inven */
#define OCMD_ROOM (1 << 2) /* obj must be in char's room */
/* obj consume trigger commands */
#define OCMD_EAT 1
#define OCMD_DRINK 2
#define OCMD_QUAFF 3
#define TRIG_NEW 0 /* trigger starts from top */
#define TRIG_RESTART 1 /* trigger restarting */
/* These are slightly off of PULSE_MOBILE so everything isnt happening at the
* same time. */
#define PULSE_DG_SCRIPT (13 RL_SEC)
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can
recurse into each other */
#define SCRIPT_ERROR_CODE -9999999 /* this shouldn't happen too often */
/* one line of the trigger */
struct cmdlist_element {
char *cmd; /* one line of a trigger */
struct cmdlist_element *original;
struct cmdlist_element *next;
};
struct trig_var_data {
char *name; /* name of variable */
char *value; /* value of variable */
long context; /* 0: global context */
struct trig_var_data *next;
};
/** structure for triggers */
struct trig_data {
IDXTYPE nr; /**< trigger's rnum */
byte attach_type; /**< mob/obj/wld intentions */
byte data_type; /**< type of game_data for trig */
char *name; /**< name of trigger */
long trigger_type; /**< type of trigger (for bitvector) */
struct cmdlist_element *cmdlist; /**< top of command list */
struct cmdlist_element *curr_state; /**< ptr to current line of trigger */
int narg; /**< numerical argument */
char *arglist; /**< argument list */
int depth; /**< depth into nest ifs/whiles/etc */
int loops; /**< loop iteration counter */
struct event *wait_event; /**< event to pause the trigger */
ubyte purged; /**< trigger is set to be purged */
struct trig_var_data *var_list; /**< list of local vars for trigger */
struct trig_data *next;
struct trig_data *next_in_world; /**< next in the global trigger list */
};
/** a complete script (composed of several triggers) */
struct script_data {
long types; /**< bitvector of trigger types */
struct trig_data *trig_list; /**< list of triggers */
struct trig_var_data *global_vars; /**< list of global variables */
ubyte purged; /**< script is set to be purged */
long context; /**< current context for statics */
struct script_data *next; /**< used for purged_scripts */
};
/* The event data for the wait command */
struct wait_event_data {
struct trig_data *trigger;
void *go;
int type;
};
/* used for actor memory triggers */
struct script_memory {
long id; /* id of who to remember */
char *cmd; /* command, or NULL for generic */
struct script_memory *next;
};
/* typedefs that the dg functions rely on */
typedef struct index_data index_data;
typedef struct room_data room_data;
typedef struct obj_data obj_data;
typedef struct trig_data trig_data;
typedef struct char_data char_data;
/* function prototypes from dg_triggers.c */
char *one_phrase(char *arg, char *first_arg);
int is_substring(char *sub, char *string);
int word_check(char *str, char *wordlist);
void act_mtrigger(const char_data *ch, char *str,
char_data *actor, char_data *victim, obj_data *object, obj_data *target, char *arg);
void speech_mtrigger(char_data *actor, char *str);
void speech_wtrigger(char_data *actor, char *str);
void greet_memory_mtrigger(char_data *ch);
int greet_mtrigger(char_data *actor, int dir);
int entry_mtrigger(char_data *ch);
void entry_memory_mtrigger(char_data *ch);
int enter_wtrigger(room_data *room, char_data *actor, int dir);
int drop_otrigger(obj_data *obj, char_data *actor);
void timer_otrigger(obj_data *obj);
int get_otrigger(obj_data *obj, char_data *actor);
int drop_wtrigger(obj_data *obj, char_data *actor);
int give_otrigger(obj_data *obj, char_data *actor,
char_data *victim);
int receive_mtrigger(char_data *ch, char_data *actor,
obj_data *obj);
void bribe_mtrigger(char_data *ch, char_data *actor,
int amount);
int wear_otrigger(obj_data *obj, char_data *actor, int where);
int remove_otrigger(obj_data *obj, char_data *actor);
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
char *argument, int type);
int command_mtrigger(char_data *actor, char *cmd, char *argument);
int command_otrigger(char_data *actor, char *cmd, char *argument);
int command_wtrigger(char_data *actor, char *cmd, char *argument);
int death_mtrigger(char_data *ch, char_data *actor);
void fight_mtrigger(char_data *ch);
void hitprcnt_mtrigger(char_data *ch);
void random_mtrigger(char_data *ch);
void random_otrigger(obj_data *obj);
void random_wtrigger(room_data *ch);
void reset_wtrigger(room_data *ch);
void load_mtrigger(char_data *ch);
void load_otrigger(obj_data *obj);
int cast_mtrigger(char_data *actor, char_data *ch, int spellnum);
int cast_otrigger(char_data *actor, obj_data *obj, int spellnum);
int cast_wtrigger(char_data *actor, char_data *vict, obj_data *obj, int spellnum);
int leave_mtrigger(char_data *actor, int dir);
int leave_wtrigger(room_data *room, char_data *actor, int dir);
int leave_otrigger(room_data *room, char_data *actor, int dir);
int door_mtrigger(char_data *actor, int subcmd, int dir);
int door_wtrigger(char_data *actor, int subcmd, int dir);
int consume_otrigger(obj_data *obj, char_data *actor, int cmd);
void time_mtrigger(char_data *ch);
void time_otrigger(obj_data *obj);
void time_wtrigger(room_data *room);
/* function prototypes from dg_scripts.c */
ACMD(do_attach) ;
ACMD(do_detach);
ACMD(do_vdelete);
ACMD(do_tstat);
char *str_str(char *cs, char *ct);
int find_eq_pos_script(char *arg);
int can_wear_on_pos(struct obj_data *obj, int pos);
struct char_data *find_char(long n);
char_data *get_char(char *name);
char_data *get_char_near_obj(obj_data *obj, char *name);
char_data *get_char_in_room(room_data *room, char *name);
obj_data *get_obj_near_obj(obj_data *obj, char *name);
obj_data *get_obj(char *name);
room_data *get_room(char *name);
char_data *get_char_by_obj(obj_data *obj, char *name);
char_data *get_char_by_room(room_data *room, char *name);
obj_data *get_obj_by_obj(obj_data *obj, char *name);
obj_data *get_obj_in_room(room_data *room, char *name);
obj_data *get_obj_by_room(room_data *room, char *name);
int trgvar_in_room(room_vnum vnum);
obj_data *get_obj_in_list(char *name, obj_data *list);
obj_data *get_object_in_equip(char_data * ch, char *name);
void script_trigger_check(void);
void check_time_triggers(void);
void find_uid_name(char *uid, char *name, size_t nlen);
void do_sstat_room(struct char_data * ch, room_data *r);
void do_sstat_object(char_data *ch, obj_data *j);
void do_sstat_character(char_data *ch, char_data *k);
void add_trigger(struct script_data *sc, trig_data *t, int loc);
void script_vlog(const char *format, va_list args);
void script_log(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
char *matching_quote(char *p);
struct room_data *dg_room_of_obj(struct obj_data *obj);
bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[]);
void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count);
void save_char_vars_ascii(FILE *file, struct char_data *ch);
int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg);
/* To maintain strict-aliasing we'll have to do this trick with a union */
/* Thanks to Chris Gilbert for reminding me that there are other options. */
int script_driver(void *go_adress, trig_data *trig, int type, int mode);
trig_rnum real_trigger(trig_vnum vnum);
void process_eval(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void read_saved_vars(struct char_data *ch);
void save_char_vars(struct char_data *ch);
void init_lookup_table(void);
void add_to_lookup_table(long uid, void *c);
void remove_from_lookup_table(long uid);
/* from dg_db_scripts.c */
void parse_trigger(FILE *trig_f, int nr);
trig_data *read_trigger(int nr);
void trig_data_copy(trig_data *this_data, const trig_data *trg);
void dg_read_trigger(FILE *fp, void *proto, int type);
void dg_obj_trigger(char *line, struct obj_data *obj);
void assign_triggers(void *i, int type);
/* From dg_variables.c */
void add_var(struct trig_var_data **var_list, char *name, char *value, long id);
int item_in_list(char *item, obj_data *list);
char *skill_percent(struct char_data *ch, char *skill);
int char_has_item(char *item, struct char_data *ch);
void var_subst(void *go, struct script_data *sc, trig_data *trig,
int type, char *line, char *buf);
int text_processed(char *field, char *subfield, struct trig_var_data *vd,
char *str, size_t slen);
void find_replacement(void *go, struct script_data *sc, trig_data *trig,
int type, char *var, char *field, char *subfield, char *str, size_t slen);
/* From dg_handler.c */
void free_var_el(struct trig_var_data *var);
void free_varlist(struct trig_var_data *vd);
int remove_var(struct trig_var_data **var_list, char *name);
void free_trigger(trig_data *trig);
void extract_trigger(struct trig_data *trig);
void extract_script(void *thing, int type);
void extract_script_mem(struct script_memory *sc);
void free_proto_script(void *thing, int type);
void copy_proto_script(void *source, void *dest, int type);
void delete_variables(const char *charname);
void update_wait_events(struct room_data *to, struct room_data *from);
/* from dg_comm.c */
char *any_one_name(char *argument, char *first_arg);
void sub_write(char *arg, char_data *ch, byte find_invis, int targets);
void send_to_zone(char *messg, zone_rnum zone);
/* from dg_misc.c */
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd);
void send_char_pos(struct char_data *ch, int dam);
int valid_dg_target(char_data *ch, int bitvector);
void script_damage(char_data *vict, int dam);
/* from dg_mobcmd.c */
ACMD(do_masound);
ACMD(do_mat);
ACMD(do_mdamage);
ACMD(do_mdoor);
ACMD(do_mecho);
ACMD(do_mechoaround);
ACMD(do_mfollow);
ACMD(do_mforce);
ACMD(do_mforget);
ACMD(do_mgoto);
ACMD(do_mhunt);
ACMD(do_mjunk);
ACMD(do_mkill);
ACMD(do_mload);
ACMD(do_mpurge);
ACMD(do_mrecho);
ACMD(do_mremember);
ACMD(do_msend);
ACMD(do_mteleport);
ACMD(do_mtransform);
ACMD(do_mzoneecho);
/* from dg_olc.c... thinking these should be moved to oasis.h */
void trigedit_save(struct descriptor_data *d);
void trigedit_string_cleanup(struct descriptor_data *d, int terminator);
int format_script(struct descriptor_data *d);
void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num);
/* from dg_objcmd.c */
room_rnum obj_room(obj_data *obj);
void obj_command_interpreter(obj_data *obj, char *argument);
/* from dg_wldcmd.c */
void wld_command_interpreter(room_data *room, char *argument);
/* defines for valid_dg_target */
#define DG_ALLOW_GODS (1<<0)
/* Macros for scripts */
#define UID_CHAR '}'
#define GET_TRIG_NAME(t) ((t)->name)
#define GET_TRIG_RNUM(t) ((t)->nr)
#define GET_TRIG_VNUM(t) (trig_index[(t)->nr]->vnum)
#define GET_TRIG_TYPE(t) ((t)->trigger_type)
#define GET_TRIG_DATA_TYPE(t) ((t)->data_type)
#define GET_TRIG_NARG(t) ((t)->narg)
#define GET_TRIG_ARG(t) ((t)->arglist)
#define GET_TRIG_VARS(t) ((t)->var_list)
#define GET_TRIG_WAIT(t) ((t)->wait_event)
#define GET_TRIG_DEPTH(t) ((t)->depth)
#define GET_TRIG_LOOPS(t) ((t)->loops)
/* player id's: 0 to MOB_ID_BASE - 1
* mob id's: MOB_ID_BASE to ROOM_ID_BASE - 1
* room id's: ROOM_ID_BASE to OBJ_ID_BASE - 1
* object id's: OBJ_ID_BASE and higher */
#define MOB_ID_BASE 50000 /* 50000 player IDNUMS should suffice */
#define ROOM_ID_BASE 1050000 /* 1000000 Mobs */
#define OBJ_ID_BASE 1300000 /* 250000 Rooms */
#define SCRIPT(o) ((o)->script)
#define SCRIPT_MEM(c) ((c)->memory)
#define SCRIPT_TYPES(s) ((s)->types)
#define TRIGGERS(s) ((s)->trig_list)
#define GET_SHORT(ch) ((ch)->player.short_descr)
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && \
IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && \
!GET_TRIG_DEPTH(t))
#define ADD_UID_VAR(buf, trig, go, name, context) do { \
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(go)); \
add_var(&GET_TRIG_VARS(trig), name, buf, context); } while (0)
#endif /* _DG_SCRIPTS_H_ */