unit zMUDapi; {interface unit for ZMUDAPI.DLL. Requires Delphi 2 or 3} interface type PCharArray = Array[1..99] of PChar; {array of PChars for parameter lists} procedure InitAPI( Handle: Integer); stdcall; {always call this before any other API calls. Use a Handle of 0 (ZERO)} procedure SendStr( S: PChar); stdcall; {send the string directly to the MUD. It is not parsed or echoed} procedure ProcessCommand( S: PChar); stdcall; {process a zMUD command line. Can be anything you would normally type in the zMUD command line} procedure EchoStr( S: PChar; Col: Integer); stdcall; {echo the string to the zMUD output window. It is not parsed or sent to the MUD. Col is the color to use: bits 1-4 are foreground color, bits 5-7 are background color, bit 8 is highlight/bold flag, bit 9 is underline, bit 10 is blink, bit 11 is Reverse} {Special values of Col: -1 is current Command Echo color, -2 is default MUD output color, -3 means to not change the color of the text and use any imbedded control codes, -100 to -115 indicates that -Col-100 is the foreground color, and the default MUD background color should be used.} function ExpandStr( S: PChar): PChar; stdcall; {expand any variables or functions calls in the string and return the result. Same as %expand(S,0) zMUD function call} function EvaluateStr( S: PChar): PChar; stdcall; {evaluates the expression in the string S and returns the result Same as %eval(S) zMUD function call} procedure zMUDCommand( ComID, NumParam: Integer; P: PCharArray); stdcall; {execute a zMUD command directly. ComID is a command ID as listed in the ZMUD.INC file. NumParam is the number of parameters specified for the command, and the parameters are stored in the P array} function zMUDFunction( ComID, NumParam: Integer; P: PCharArray): PChar; stdcall; {execute a zMUD function directly and return the result. ComID is the function ID as listed in the ZMUD.INC file. NumParam is the number of parameters specified for the function, and the parameters are stored in the P array} function SpecialChar( Ch: Char): Char; stdcall; {return the current value of one of the zMUD special characters. Pass the default value such as ';' for the command seperator, or '#' for the command character, and this function will return the actual character being used by the user} function zMUDFileName( FileName, Subfolder: PChar): PChar; {returns the full pathname necessary to store FileName in the Subfolder of the current character directory. To access files in the same directory as the *.MUD settings, leave Subfolder as nil. To access files in the Maps subdirectory, set it to 'Maps', etc} function zMUDVersion: Integer; stdcall; {return the current zMUD version. Returns MajorVersion*100+MinorVersion, so v5.30 is returned as 530} function zMUDHandle: Integer; stdcall; {returns the window handle of the main zMUD window} function zMUDApp: Pointer; stdcall; {returns a pointer to the zMUD TApplication object. NOTE: This only works within a DLL plugin and will not work with a seperate external application} {Also, using the TApplication object makes your plugin require the same version of Delphi as zMUD uses} function zMUDAppHandle: Integer; stdcall; {returns the window handle of the zMUD application} procedure zMUDFocus; stdcall; {gives cursor focus back to the zMUD application} function zMUDIsActive: Boolean; stdcall; {returns true if zMUD is the currently active and focused application on the system} function zMUDWindow( Name: PChar): Integer; stdcall; {returns the Name and Handle of the current MUD output window. The Name is the window caption, and the returned number is the Windows handle. Use this to determine which Window currently has focus.} {The UpdatePlugin routine in the Plugin is called whenever the current MUD window changes} procedure LoadPlugin( Name: PChar; LoadFlag: Boolean); stdcall; {load or unload a plugin. Name is the name of the plugin as given with the RegisterPlugin routine. If LoadFlag is true, the plugin is loaded (if not already loaded), and if LoadFlag is false, the plugin is unloaded (if not already unloaded)} procedure LoadPluginProc( Name, ProcName: PChar; LoadFlag: Boolean); stdcall; {load or unload a specific procedure of the Name plugin. ProcName is the name of the procedure. If LoadFlag is true, load the procedure, otherwise unload the procedure. The purpose of this routine is to load and unload routines that can slow down zMUD. For example, if you don't need to capture the MUD output all of the time, unload the CaptureOutput routine after the plugin is initialized, and then just load it as needed} {ProcName must be one of the predefined API routine names that zMUD calls in your plugin} implementation const APIFile = 'ZMUDAPI.DLL'; procedure InitAPI; external APIFile name 'InitAPI'; procedure SendStr; external APIFile name 'SendStr'; procedure ProcessCommand; external APIFile name 'ProcessCommand'; procedure EchoStr; external APIFile name 'EchoStr'; function ExpandStr; external APIFile name 'ExpandStr'; function EvaluateStr; external APIFile name 'EvaluateStr'; procedure zMUDCommand; external APIFile name 'zMUDCommand'; function zMUDFunction; external APIFile name 'zMUDFunction'; function zMUDFilename; external APIFile name 'zMUDFilename'; function SpecialChar; external APIFile name 'SpecialChar'; function zMUDVersion; external APIFile name 'zMUDVersion'; function zMUDHandle; external APIFile name 'zMUDHandle'; function zMUDApp; external APIFile name 'zMUDApp'; function zMUDAppHandle; external APIFile name 'zMUDAppHandle'; procedure zMUDFocus; external APIFile name 'zMUDFocus'; function zMUDIsActive; external APIFile name 'zMUDIsActive'; function zMUDWindow; external APIFile name 'zMUDWindow'; procedure LoadPlugin; external APIFile name 'LoadPlugin'; procedure LoadPluginProc; external APIFile name 'LoadPluginProc'; end.