Manual:DIL Manual/Built-In Procedures

From DikuMUD Wiki
Jump to navigation Jump to search


Built-In Procedures:

    DIL features some built-in procedures that allows you increased control over
  in-game data structures and event handling. Once such procedure (used above)is
  'exec()'. The inline procedures are used as any other procedure by typing its
  name, followed by a list of argument expression enclosed in parentheses. The
  return types of the expressions used for built-in procedure calls are checked
  by the compiler.
    DIL also lets you call templates defined in the current or other zones.  The
  naming of templates follows the normal naming convention for zone, using the
  'name@zone' as a symbolic name for a procedure.  Before being able to use
  external procedures, you must define their name and type in a separate
  'external' section in the template.  The declaration in the 'external' section
  should match the original declaration of the referenced program. You can define
  the number and type of arguments the template take, by listing them inside the
  declaration parenthesis (as well as in the original declaration of that template)
  (see example below)
Example:

   dilbegin bar(s:string);
   code
   {
     exec("say "+s,self);
     return;
   }
   dilend

   dilbegin foo();
   external
     someproc@hades1();
     bar(s:string);
   code
   {
     someproc@hades1();
     bar("Hello "+activator.name);
     pause;
   }
   dilend
    When the procedure is called, the argument expressions are calculated, and
   passed to the template.  Built-in procedures, their arguments and function
   are listed later.
    The following are definitions and documentation for the built-in procedures
   in DIL. The definitions are not definitions 'as such', but serve to distinguish
   arguments in the documentation below.


---~---~---~---~---~---~---~---~---