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. The object and a target room can also be given by address: Obj.invoke( 'club.pebble-necklace', actor ) (see JS-NAMES).

Properties:

equippedByReturns the character that is equipping this item or null if it is not equipped.
controllerWho is this object's controller? (see JS-CONTROLLER)
inObjThe container this object is in or null.
inRoomThe room object that this object is in (see JS-ROOM).
inRoomNumberThe room number of this object.
inZoneZone object that this object is in (see JS-ZONE).
inWorldWorld object that this object is in (see JS-WORLD).
vnumThe virtual number of this object.
dbThe database object for this object (see JS-DB)
nameThe key name of this object.
longDescThe long description of this object.
shortDescThe short description of this object.
actionDescThe action description of this object.
typeReturns the type of the object (see ITEMTYPE).
hitThe current hit points of this object.
maxHitThe maximum hit points of this object.
versionThe item's version.
levelThe item's level.
egoThe item's ego.
costThe cost of the item if it is sold.
rentCostThe item's rent cost per day.
weightThe weight of this object.
volumeThe volume object takes up.
value0-4The object values value0 through value4.
corpseVnumFor corpses dropped by mobiles, it returns the mobile's vnum.
corpseNameFor 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 address ('moz.brass-key', or the old number) is in the object. This method supports cardinalities -- see JS-CARDINALITY.
findObj( v )Finds and returns an object by the specified address (or the old number) 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.