[1199] in Coldmud discussion meeting

root meeting help first first in chain previous in chain previous next next in chain last in chain last

Re: [COLD] What can I do with $robot?

daemon@ATHENA.MIT.EDU (Wed Jan 1 14:41:26 1997 )

Date: Wed, 1 Jan 1997 12:32:51 -0700 (MST)
From: Brandon Gillespie <brandon@glacier.cold.org>
To: Frank Crowell <frankc@maddog.com>
cc: Cold Stuff <coldstuff@cold.org>
In-Reply-To: <32C66910.4A2148E3@maddog.com>

On Sun, 29 Dec 1996, Frank Crowell wrote:
> I created a clone of $robot and changed a couple of 
> attributes, but I don't seem to know how to use/extend the
> $robot.  As a minimum I would like it to behave like
> a MUSH puppet so that I could:

$robot is still a work-in-progress.. I only started developing it a few
weeks ago.

> 	-set it so the object hears and the messages
> 		can either be pattern-matched or 
> 		processed in some other way
> 		(for example on LambdaMOO I have 
> 		a puppet with a tell_to set to me)
> 
> 	-have it respond to tells/pages so I can get 
> 	it to do things.

It'll do this and much more.  The expected list of features is:

    + puppeteering
       Allowing somebody to use it as a puppet, seeing
       and reacting etc.
    + reactions
       React to events and text from the environment.
    + scenes
       A pre-defined sequence of actions or a behaviour which
       can be triggered.
    + internal heartbeat
       A self-monitored heartbeat that will wind-down and wind-up
       as appropriate based off the robot's activity.

The foundation for reactions is basically complete.  The interface is very
raw at the moment, as I finish the designs for the other systems. 
_Temporarily_ you can use the command '@reactions <object>' to list the
reactions.  You need to first add a reaction, and then activate it (two
steps as a robot could have a large library of reactions that it activates
and deactivates as it goes based off other events, scenes, heartbeat,
etc).  To add a reaction call .add_reaction() on the robot with eight
arguments, as follows:

  ARG 1 (symbol): match with

      This is the type of matching to use, it is a symbol representing a
      method to be called off $string.  It is commonly accepted to be:

          'regexp 'match_pattern 'match_template

      If more than this is used you must update $robot,match_types.  I may
      add a capability which uses the 'in' operator.

  ARG 2 (string): match template

      This is the template matched against.  If the template is an empty
      string the reaction always matches, assuming it already passed the
      chance of reacting.

  ARG 3 (symbol): type of input to react to

      To reduce the overall lag of a large set of reactions they are
      defined to react to a possible subset of input, which is:

          'tell     -- react only to text sent to .tell() (does not
                       include directed tells and social events).
          'notell   -- react to anything other than that sent to .tell()
                       (i.e. any event or directed tell).
          'any      -- react to anything.  This is the least efficient
                       and is not suggested.

      Or any social event (currently 'whisper, 'tosay and 'page).

   ARG 4 (integer): chance of reacting

      Simply a number from 1 to 100, representing the chance of reacting.

   ARG 5 (integer): the number of times to react.

      Either -1 (react an infinite amount of times) or a number which
      is decremented to zero for each reaction, at which point the
      reaction is deactivated.

   ARG 6 (list): hook

      Hook is a two element list which will likely be reduced to seperate
      arguments (at the time of development it could be from one to any
      number of elements).  The elements are broken down to:

      ELEMENT 1 (symbol): method to call

          This is the method to call if the reaction is triggered.  Look
          at `@d $robot.react_*` to see the currently defined hooks.

      ELEMENT 2 (list): additional arguments for method call

          These arguments are added after the standard arguments, to the
          method call for the above method.

   ARG 7 and 8 (integers): minimum and maximum delay

      This is the delay before the reaction hook is called.

When you add a reaction it will be given an integer ID, call
robot.activate_reaction() with the ID (otherwise it will not react).  You
will also want to call robot.startup() for it to hook into the appropriate
events. 

BTW, the robot's manager is where all tells and whatnot are directed
(assuming the manager is not in the same room as the robot).  This will
get to be more intelligent in the future.  Also, expect things to change
in the future, as its all still under development.  

-Brandon Gillespie