RoBOTL

DefineNewInstruction definition


DefineNewInstruction new_instr_name as instruction
DefineNewInstruction new_instr_name as { instructions }

This defines a new instruction by the name new_instr_name, for use by any robots of the type being defined by the NewRobotType instruction. Note that you can't override or redefine an instruction inherited from any other robot, including basic_bot. This new instruction will execute the indicated instruction (or sequence of instructions) whenever new_instr_name is executed.
The DefineNewInstruction defintion can also be specified using define_new_instruction.
Example:
define
{
   NewRobotType beeper_bot
   {
      IsLikeA basic_bot;
      DefineInitialBeepers 5;
      DefineNewInstruction turnright as
      {
         iterate 3 times TurnLeft;
      }
   }
}
execute
{
   new beeper_bot kathy at 5,4;
   tell kathy: turnright;
}

Other definitions:
You can also go:

Created on 19 June 1995
Last revised 20 August 1996
Copyright ©1995,1996 Walter S. Ching, n1hbr@ma.ultranet.com