UOX3 Script Engine

API and Event handling

Item Related Functions

GetAmount
Prototype
short GetAmount( int trgItem );
PurposeReturns the amount of trgItem
Example of Usage
amt = GetAmount( srcItem );

 

GetContainer
Prototype
long GetContainer( int trgItem );
PurposeReturns the serial of the container of trgItem
Example of Usage
cSerial = GetContainer( srcItem );

 

SetAmount
Prototype
SetAmount( trgItem, trgAmount );
PurposeSets trgItem's amount value to trgAmount
Example of Usage
SetAmount( trgItem, 10 );

 

SetContainer
Prototype
SetContainer( trgItem, newContSerial );
PurposeSets the trgItem's container SERIAL to newContSerial
Example of Usage
SetContainer( trgItem, GetSerial( srcChar, 0 ) );

 

GetType
Prototype
int GetType( trgItem );
PurposeReturns type of trgItem
Example of Usage
iType = GetType( srcItem );

 

SetType
Prototype
SetType( trgItem, trgType );
PurposeSets trgItem's type to trgType
Example of Usage
SetType( srcItem, 1 );

 

GetMore
Prototype
int GetMore( trgItem );
PurposeReturns MORE value of trgItem
Example of Usage
iMore = GetMore( srcItem );

 

GetMoreX
Prototype
int GetMoreX( trgItem );
PurposeReturns MOREX value of trgItem
Example of Usage
iMore = GetMoreX( srcItem );

 

GetMoreY
Prototype
int GetMoreY( trgItem );
PurposeReturns MOREY value of trgItem
Example of Usage
iMore = GetMoreY( srcItem );

 

GetMoreZ
Prototype
int GetMoreZ( trgItem );
PurposeReturns MOREZ value of trgItem
Example of Usage
iMore = GetMoreZ( srcItem );

 

SetMore
Prototype
SetMore( trgItem, newMore );
PurposeSets trgItem's more value to newMore
Example of Usage
SetMore( doorItem, GetMore( key ) );

 

SetMoreX
Prototype
SetMoreX( trgItem, newMore );
PurposeSets trgItem's morex value to newMore
Example of Usage
SetMoreX( doorItem, GetMore( key ) );

 

SetMoreY
Prototype
SetMoreY( trgItem, newMore );
PurposeSets trgItem's moreY value to newMore
Example of Usage
SetMoreY( doorItem, GetMore( key ) );

 

SetMoreZ
Prototype
SetMoreZ( trgItem, newMore );
PurposeSets trgItem's morez value to newMore
Example of Usage
SetMoreZ( doorItem, GetMore( key ) );

 

GetMovable
Prototype
int GetMovable( trgItem );
PurposeReturns movability of an item
Example of Usage
var iMov = GetMovable( srcItem );

 

SetMovable
Prototype
SetMovable( trgItem, newMove );
PurposeSets the trgItem's movable property to newMove
Example of Usage
SetMovable( srcItem, 3 );

 

GetAtt
Prototype
int GetAtt( trgItem );
PurposeReturns attack value of an item, random between lo and hi damage
Example of Usage
var iAttack = GetAtt( srcItem );

 

SetAtt
Prototype
SetAtt( trgItem, loDamage, hiDamage );
PurposeSets the low and high damage inflicted by trgItem
Example of Usage
SetAtt( srcItem, 0, 10 );

 

GetDef
Prototype
int GetDef( trgItem );
PurposeReturns defense value of an item
Example of Usage
var iDef = GetDef( srcItem );

 

SetDef
Prototype
SetDef( trgItem, defValue );
PurposeSets trgItem's def value to defValue
Example of Usage
SetDef( srcItem, 10 );

 

GlowItem
Prototype
Purpose
Example of Usage

 

GetResourceCount
Prototype
GetResourceCount( player, itemID, itemColour );
PurposeReturns a count of how many items with id itemID and colour itemColour player has
Example of Usage
var ingotAmt = GetResourceCount( player, 0x1BF2, 0 );

 

UseResource
Prototype
UseResource( player, itemID, itemColour, amount );
PurposeDeletes amount number of items with id itemID and colour itemColour on player
Example of Usage
UseResource( player, 0x1BF2, 0, 5 );

 

FindItemOnLayer
Prototype
int FindItemOnLayer( player, tLayer );
PurposeFinds the item that player has on layer tLayer.
NotesA return value of -1 indicates there was no item at that particular layer. A common list of layers follow

0x01 - Single-Hand item/weapon
0x02 - Two-Hand item/weapon (including Shield)
0x03 - Foot Covering/Armor
0x04 - Leg Covering (including Pants, Shorts, Bone/Chain/Ring legs)
0x05 - Chest Clothing/Female Chest Armor
0x06 - Head Covering/Armor
0x07 - Hand Covering/Armor
0x08 - Ring
0x09 - N/A (not used)
0x0A - Neck Covering/Armor
0x0B - Hair
0x0C - Waist (Half-Apron)
0x0D - Torso (inner)(Chest Armor)
0x0E - Bracelet
0x0F - N/A (no info)
0x10 - Facial Hair
0x11 - Torso (Middle)(Surcoat, Tunic, Full Apron, Sash)
0x12 - Earrings
0x13 - Arm Covering/Armor
0x14 - Back (Cloak)
0x15 - BackPack
0x16 - Torso (outer)(Robe)
0x17 - Legs (outer)(Skirt/Kilt)
0x18 - Legs (inner)(Leg Armor)
0x19 - Mount (Horse, Ostard, etc.)
0x1A - NPC Buy Restock Container
0x1B - NPC Buy No Restock Container
0x1C - NPC Sell Container
0x1D - Bank Box
Example of Usage
var iLeftHand = FindItemOnLayer( pTalking, 1 );	// finds the item in the left hand of pTalking

 

GetLayer
Prototype
GetLayer( iToCheck );
PurposeReturns the layer attribute of the item iToCheck
Example of Usage
var iLayer = GetLayer( iStolen );

if( iLayer == 0x15 )
{
TextMessage( pThief, "Wow, I stole a pack" );
}

 

SetLayer
Prototype
SetLayer( iToCheck, iLayer );
PurposeSets the layer attribute of the item iToCheck to iLayer
Example of Usage
var iLayer = GetLayer( iStolen );

if( iLayer == 0x15 )
{
SetLayer( iStolen, 0x01 );
TextMessage( pThief, "Mwahaha, this pack is now useless!" );
}

 

FirstItemInCont
Prototype
int FirstItemInCont( iToScan );
PurposeReturns a handle to the first item in the container. If it's -1, then there is no items.
Example of Usage
var iStuff;

var myGold = 0;
for( iStuff = FirstItemInCont( iStolen ); !FinishedItemInCont( iStolen ); iStuff = NextItemInCont( iStolen );
{
if( iStuff != -1 && GetID( iStuff, 1 ) == 0x0EED ) // we have gold!
{
myGold = myGold + GetAmount( iStuff );
}
}
if( myGold > 10000 )
{
TextMessage( pThief, "I'm RICH!!!!!!!" );
}

 

NextItemInCont
Prototype
int NextItemInCont( iToCheck );
PurposeReturns the next item found in the container
Example of Usage
SEE ABOVE FUNCTION

 

FinishedItemInCont
Prototype
bool FinishedItemInCont( iToCheck );
PurposeReturns true if there are no more items left to look through
Example of Usage
SEE ABOVE FUNCTION

 

©Copyright 2000-2001 WWW.UOX3.NET (Daniel Stratton/Matthew Randall)