Items

From SphereWiki
Revision as of 02:04, 6 June 2009 by MrSugarCube (talk | contribs)
Jump to: navigation, search

Generally speaking, there are two types of "things" in the game; characters and items. Compared to characters, items are very complex. Items have a number of different uses, for example a sword is an item that players can see and equip to increase the damage they can do in combat. Some items in the game can not be seen by the players, but they have as much impact on the player as their sword, for example, a memory item is equipped every time a player is under the effects of a spell. The following tables detail the various properties of items in SphereServer:


References

References return pointers to other objects (e.g. the REGION reference allows you to access the REGION that an object is in). These can either be accessed by using <REFNAME> to return the UID (1 for object types that don't have UIDs) of the object or 0 if it doesn't exist, or by using <REFNAME.KEY> where KEY is a valid property/function/reference for the REFNAME object. Click on the name for more detailed information such as usage and examples.

Name Read/Write Description
CONT RW Gets or sets the container that the object is in.
LINK RW Gets or sets the object that the item is linked to.
REGION R Gets the region that the object is in.
ROOM R Gets the room that the object is in.
P RW Gets or sets the position that the object is at.
SECTOR R Gets the sector that the object is in.
TOPOBJ R Gets the top-most object in the world that contains the item.
TYPEDEF R Gets the ITEMDEF that defines the item.


Properties and Functions with a Return Value

Here is a list of all item properties and functions that can return a value when used as <KEY>. Click on the name for more detailed information such as usage and examples.

Name Read/Write Description
ADDSPELL spell_id R Gets whether or not a spell exists in the spellbook.
AMOUNT RW Gets the amount of this items this item represent (e.g. a pile of gold).
ATTR RW Gets or sets the item's attribute flags.
CANSEE R Returns 1 if SRC can see the item.
CANSEELOS R Returns 1 if SRC has line of sight to the item.
CANSEELOSFLAG flags R Returns 1 if SRC has line of sight to the item, with flags to modify what tests take place.
COLOR RW Gets or sets the object's hue.
CONTGRID RW If in a container, gets or sets the grid number that the item occupies (in KR's grid view)
CONTP RW Gets or sets the position of the item within its container.
DEFMSG.message text RW Gets or sets the text of a DEFMESSAGE from sphere_msgs.scp
DISPID RW Gets or sets the ID that the item will appear as to players.
DISPIDDEC RW Same as DISPID, except it returns the ID as a decimal number.
DISTANCE point_or_uid R Gets the distance between this object and either SRC, a map location or another object.
DMGCOLD RW Gets or sets the amount of cold damage the weapon will give.
DMGENERGY RW Gets or sets the amount of energy damage the weapon will give.
DMGFIRE RW Gets or sets the amount of fire damage the weapon will give.
DMGPOISON RW Gets or sets the amount of poison damage the weapon will give.
EVENTS event_defname RW Gets a list of events attached to the object, or adds or removes an event to or from the object.
FRUIT RW
HEIGHT R Gets the height of the item.
HITS RW Gets or sets the number of hitpoints the item has.
HITPOINTS RW Gets or sets the number of hitpoints the item has.
ID RW Gets or sets the ID of the item.
ISARMOR object_uid R Returns 1 if the object is armour.
ISCHAR R Returns 1 if the object is a character.
ISCONT R Returns 1 if the object is a container.
ISEVENT.event_defname R Returns 1 if the object has an event attached to it.
ISITEM R Returns 1 if the object is an item.
ISNEARTYPE type, distance, flags R Returns 1 if a nearby item has the given TYPE.
ISNEARTYPETOP type, distance, flags R Returns a nearby world location of a nearby item which has the given TYPE.
ISPLAYER R Returns 1 if the object is a player.
ISTEVENT.event_defname R Returns 1 if the object has an event attached to its ITEMDEF.
ISWEAPON object_uid R Returns 1 if the object is a weapon.
LAYER RW Gets or sets the layer that the item occupies when equipped.
MAP RW Gets or sets the map that this object is located.
MAXHITS RW Gets or sets the maximum number of hitpoints the item can have.
MODAR RW Gets or sets a modifier for the item's armour rating.
MORE1 RW Gets or sets the MORE1 value for the item.
MORE1H RW Gets or sets the upper 4 bytes of the item's MORE1 value.
MORE1L RW Gets or sets the lower 4 bytes of the item's MORE1 value.
MORE2 RW Gets or sets the MORE2 value for the item.
MORE2H RW Gets or sets the upper 4 bytes of the item's MORE2 value.
MORE2L RW Gets or sets the lower 4 bytes of the item's MORE2 value.
MOREM RW Gets or sets the MOREM value for the item.
MOREX RW Gets or sets the MOREX value for the item.
MOREY RW Gets or sets the MOREY value for the item.
MOREZ RW Gets or sets the MOREZ value for the item.
MOREP RW Gets or sets the MOREP value for the item.
NAME RW Gets or sets the object's name.
SERIAL R Gets the item's unique ID in the world.
SEXTANTP location R Converts the item's location or a specified location into sextant coordinates.
TAG.name RW Gets or sets the value of a TAG.
TAGAT.index R Gets a TAG at the given zero-based index.
TAGAT.index.KEY R Gets the name of the TAG at the given zero-based index.
TAGAT.index.VAL R Gets the value of the TAG at the given zero-based index.
TAGCOUNT R Gets the number of TAGs stored on the item.
TIMER RW Gets or sets the length of time before the item's timer expires, in seconds.
TIMERD RW Gets or sets the length of time before the item's timer expires, in tenths of a second.
TRIGGER trig_name, trig_type R Fires a custom trigger and returns the RETURN value.
TYPE RW Gets or sets the item type.
UID R Gets the item's unique ID in the world.
WEIGHT R Gets the weight of the item.
Z R Gets the Z position of the item.


Properties and Function without a Return Value

Here is a list of all item properties and functions that do not return a value. Click on the name for more detailed information such as usage and examples.

Name Description
ADDCIRCLE spell_circle Adds all of the spells in the given circle to the spellbook.
ADDSPELL spell_id Adds a spell to the spellbook.
BOUNCE Moves the item to SRC's backpack.
CLEARTAGS prefix Removes all TAGs from the item that start with the given prefix.
CONSUME amount Deducts an amount from the item, deleting it at 0.
CONTCONSUME resource_list Deletes items from inside the container.
DCLICK Double clicks the item, with SRC as the source of the event.
DAMAGE amount, type, source Inflicts damage upon the item.
DECAY time Sets the decay timer for the item.
DIALOG dialog_id, page, parameters Displays a dialog to SRC.
DROP Drops the item to the ground.
DUPE Clones the item.
EDIT Displays an editing dialog for the item to SRC.
EFFECT type, item_id, speed, loop, explode, colour, rendermode Displays an effect to nearby clients.
EMOTE message Displays a *You see* message to all nearby clients.
EQUIP Equips the item to SRC.
FIX Re-aligns the item's Z level to ground level.
FLIP Rotates the item.
INFO Displays an information dialog about the item to SRC.
MENU menu_defname Displays a menu to SRC.
MESSAGE message Displays a message above this item to SRC.
MESSAGEUA colour, talkmode, font, lang_id, message Displays a UNICODE message above thsi item to SRC.
MOVE direction, amount
MOVE x y
Moves the object relative to its current position.
MOVENEAR object_uid, distance Moves the object to a random location near another object within a certain distance.
MOVETO location Moves the object to a specific location.
NUDGEDOWN amount Decreases the object's Z level.
NUDGEUP amount Increases the object's Z level.
PROMPTCONSOLE function, prompt_message Displays a prompt message to SRC and passes their response into a specified function.
PROMPTCONSOLEU function, prompt_message Displays a prompt message to SRC and passes their response into a specified function, supporting UNICODE response.
REMOVE Deletes the object.
REMOVEFROMVIEW Removes the object from nearby clients' screens.
RESENDTOOLTIP Forces Sphere to update the tooltips for nearby clients.
SAY message Makes the object speak a message.
SAYU message Makes the object speak a UTF-8 message
SAYUA colour, talkmode, font, lang_id, text MAkes the object speak a UNICODE message.
SDIALOG dialog_id, page, parameters Displays a dialog to SRC, providing that it is not already open.
SOUND sound_id, repeat Plays a sound from this object.
SPELLEFFECT spell_id, strength, source_character_uid, source_item_uid Causes the item to be affected by a spell.
TAGLIST Outputs a list of the object's TAGs.
TARGETFGMW function Displays a targeting cursor to SRC.
TIMERF time, function Scheduled a function to be executed on this object in time seconds.
TIMERF CLEAR Clears all scheduled functions from the object.
UNEQUIP Unequips the item and places it in SRC's backpack.
UPDATE Updates the state of the item to nearby clients.
UPDATEX Updates the state of the item to nearby clients, removing it from their view first to ensure a full refresh.
USE check_los Uses the item, as if SRC had double clicked it.
USEITEM Double clicks the item, with SRC as the source of the event, without checking for line of sight.


Triggers

Here is a list of all item triggers. Click on the trigger name for more detailed information such as arguments and examples.

Name Description
@AfterClick Fires when the object has been single-clicked, after the hardcoded behaviour.
@Buy Fires when the item is being bought from a vendor.
@Click Fires when the object has been single-clicked.
@ClientTooltip Fires when tooltips are about to be sent to a client.
@ContextMenuRequest Fires when a client requests the context menu options for the object.
@ContextMenuSelect Fires when a client selects a context menu option for the object.
@Create Fires when the object is initially created, before it is placed in the world.
@Damage Fires when the item receives damage.
@DClick Fires when the object is double-clicked.
@Destroy Fires when the object is being deleted.
@DropOn_Char Fires when the item has been dropped on to a character.
@DropOn_Ground Fires when the item has been dropped on to the ground.
@DropOn_Item Fires when the item is dropped on to another item.
@DropOn_Self Fires when an item has been dropped on to this item.
@Equip Fires when the item has been equipped.
@EquipTest Fires when the item is about to be equipped.
@Fire
@PickUp_Ground Fires when the item ihas been picked up from the ground.
@PickUp_Pack Fires when the item is picked up from inside a container.
@PickUp_Self Fires when an item has been picked up from inside the item.
@PickUp_Stack Fires when the item is picked up from a stack.
@Sell Fires when the item is sold to a vendor.
@SpellEffect Fires when the object is hit by the effects of a spell.
@Step Fires when a character steps on the item.
@TargOn_Cancel Fires when a target is cancelled from the item.
@TargOn_Char Fires when a character is targeted from the item.
@TargOn_Ground Fires when the ground is targeted from the item.
@TargOn_Item Fires when an item is targeted from this item.
@Timer Fires when the item's timer expires.
@ToolTip
@UnEquip Fires when the item is unequipped.