Mload

Main.Mload History

Hide minor edits - Show changes to markup

December 31, 2008, at 06:06 PM EST by admin
Added lines 1-25:
     mload - syntax: mload("mobkey",ROOM) 

Creates an instance of "mobkey" and places it in the same room as the character running the prog. There are no additional options on this command.

By default, mload assumes there is a 'self' actor and will load the new mob in the current room. In room progs, there may not be an actor so the second argument can be either a ROOM type variable or a room key to indicate where the new mob should be loaded.

   --- If there is no aylor-20 in the room, create one.
   if not(mobexists("aylor-20",room)) then
      mload("aylor-20")
   end

Mload also returns a CH type variable with the mob created. Most of the time this will be ignored, but can be useful with the 'call' function or other functions that take a CH variable. For example, if you want to load a mob then transfer it somewhere, rather than dealing with keyword issues you could do:

   --- Create a mob
   local newmob = mload("aylor-20")

   --- Use the ch variable for transfer.
   transfer(newmob,"aylor-321")

   --- Or, if you want to use the newmob in an echo 
   --- $n is the mob running the prog. $N is whatever char is given.
   echo("$n waves $s arms and $N appears!",newmob)