Oload

Main.Oload History

Hide minor edits - Show changes to markup

December 31, 2008, at 06:17 PM EST by admin
Added lines 1-31:
     oload - syntax: oload("objkey",level,location,[TARG]) 

Prog Types: Mob, Object, Room

Creates an item with key objkey. Level and location are both optional. If level is given, item is set to that level. By default, the item goes to the mob's inventory if takeable and to the room if not. A location of "room" will make the item always go to the room. A location of "wear" will cause the mob to wear the item. Targ is a CH variable to be used when oload is called from a prog in which there is no actor - targ is the char on which the item will be placed.

   --- Create a portal, give it to the character.
   --- Mandatory to have one of these progs in each area.
   oload("aylor-123")
   give("portal",ch)

   --- You could also just use:
   give(oload("aylor-123"),ch)

   --- Oload with no actor.
   --- Prog in orchard when user types 'shake tree'
   if carries(ch,"orchard-0") then
      send(ch,"You give the tree a good shake, but no apples fall.")
   else 
      send(ch,"You give the tree a good shake.nrA shiny red apple falls and you quickly catch it.")
       oload("orchard-0",0,nil,ch)
   end

Oload also returns an OBJ variable with the item created. Most of the time, this will be ignored. If needed, it can be assigned to a local variable then manipulated. For example, if a mob loads an item then sets ownership on it, you would use:

   local newobj = oload("aylor-123")
   newobj.owner = ch.name