Help

JS-OBJ

For immortals Also: JAVASCRIPT-OBJ

The Obj object represents objects/items.

Class Methods:

count()           Counts objects.  See JS-ELEMENT-COUNT.
invoke( <object vnum>, <target>, ['equip',] ['spawn',] ['limit', ['saved',] <limit>]  )

The invoke method on objects allows you to create a new object. The "target" can either be a room number or a mobile, object, or room object. If the target is a mobile, you can specify the "equip" option to indicate that the object should be invoked and then immediately equipped. The 'spawn' option will cause the item to get a spawned event. If the 'limit' option is given then the mud will not load the item if there are already limit items in the game. Specify 'saved' if you would also like the mud to count items on players not currently logged in toward the limit as well. See JS-OBJ-INVOKE-EXAMPLES.

Properties:

equippedBy          Returns the character that is equipping this item or
                    null if it is not equipped.
controller          Who is this object's controller? (see JS-CONTROLLER)
inObj               The container this object is in or null.
inRoom              The room object that this object is in (see JS-ROOM).
inRoomNumber        The room number of this object.
inZone              Zone object that this object is in (see JS-ZONE).
inWorld             World object that this object is in (see JS-WORLD).
vnum                The virtual number of this object.
db                  The database object for this object (see JS-DB)
name                The key name of this object.
longDesc            The long description of this object.
shortDesc           The short description of this object.
actionDesc          The action description of this object.
type                Returns the type of the object (see ITEMTYPE).
hit                 The current hit points of this object.
maxHit              The maximum hit points of this object.
version             The item's version.
level               The item's level.
ego                 The item's ego.
cost                The cost of the item if it is sold.
rentCost            The item's rent cost per day.
weight              The weight of this object.
volume              The volume object takes up.
value0-4            The object values value0 through value4.
corpseVnum          For corpses dropped by mobiles, it returns the mobile's vnum.
corpseName          For corpses dropped by players, it returns the player's name.

Methods:

cast()              Casts a spell.  See JS-ELEMENT-CAST.
damage()            Does damage.  See JS-ELEMENT-DAMAGE.
go( d )             Teleports the object to the specified destination which can be
                    either a room, object, or mobile or a room number.  Pass
                    in the string 'fadeout' if you would like fadeout messages to
                    be displayed.  Example:  "subject.go( 1002, 'fadeout' )"
bearer()            The character who is carrying this object (or null if it
                    is not being carried).
purge()             Destroys this object.
scrap()             Scraps this object.
hasObj( v )         Returns true if an object by the specified vnum is in the object.
                    This method supports cardinalities -- see JS-CARDINALITY.
findObj( v )        Finds and returns an object by the specified vnum in the object.
isActive()          Returns true if the object is active.
isAura()            Returns false
isMobile()          Returns false
isObj()             Returns true
isRoom()            Returns false
isCorpse()          Returns true if this object is a PC or NPC corpse.
isPCCorpse()        Returns true if this object is a PC corpse.
isNPCCorpse()       Returns true if this object is an NPC corpse.
isControlledByPC()  Returns true if this object is under the control of a PC.
like()              See JS-LIKE.
toString()          Returns the key name of the object.
valueOf()           Returns the key name of the object.
visitContents( f )  Applies the passed in function or array to all of the contents
                    of this object.  This method does not recursively visit
                    the contents of containers that are inside this object.
                    See JS-VISIT for more information.
hasFlag( f )        Returns true if the object has the specified object flag
                    (see ITEMFLAGS and WEARFLAGS).
                    This method supports cardinalities -- see JS-CARDINALITY.
setFlag( f, v )     Sets the object flag "f" to the value "v" which should evaluate
                    to true or false.
hasAura( n )        Returns true if the object has this aura.
                    This method supports cardinalities -- see JS-CARDINALITY.
addAura()           See JS-ELEMENT.
removeAura()        See JS-ELEMENT.
addAuraCat()        See JS-ELEMENT.
removeAuraCat()     See JS-ELEMENT.
resistFor( r )      Returns the given resistance (see RESISTANCE).  You
                    can also use the 'average' option to get the average resist.
addResist( r, a )   Adds the amount a to the given resistance r.
daysOld()           Returns how many days have passed since this object was created.
ticksOld()          Returns how many ticks have passed since this object was created.

Last edited by Winterstar in May 2004.