UOX3 Script Engine

API and Event handling

Character and Item common functions

GetName
Prototype
string GetName( srcChar, srcType );
PurposeReturns the name of the object srcChar.
srcType == 0 indicates a character
srcType == 1 indicates an item
Example of Usage
iName = GetName( srcChar, 0 );

 

SetName
Prototype
void SetName( srcChar, newName, srcType );
PurposeSets the name of the object to newName.
srcType == 0 indicates a character
srcType == 1 indicates an item
Example of Usage
SetName( srcChar, "Abaddon", 0 );

 

GetTitle
Prototype
string GetTitle( srcChar );
PurposeReturns the title of srcChar
Example of Usage
sTitle = GetTitle( srcChar );

 

SetTitle
Prototype
void SetTitle( srcChar, newTitle );
PurposeSets srcChar's title to newTitle
Example of Usage
SetTitle( srcChar, "Destroyer of Worlds" );

 

GetX
Prototype
short GetX( int trgChar, int type );
PurposeReturns the x location of trgChar
Type == 0: Character
Type == 1: Item
Example of Usage
trgX = GetX( srcChar, 0 );

 

GetY
Prototype
short GetY( int trgChar, int type );
PurposeReturns the y location of trgChar
Type == 0: Character
Type == 1: Item
Example of Usage
trgY = GetY( srcChar, 0 );

 

GetZ
Prototype
short GetZ( int trgChar, int type );
PurposeReturns the z location of trgChar
Type == 0: Character
Type == 1: Item
Example of Usage
stm = GetZ( srcChar, 0 );

 

SetLocation
Prototype
SetLocation( int trgChar, short targX, short targY, SCHAR targZ, int type );
PurposeMoves the character trgChar to (targX, targY, targZ );
Type == 0: Character
Type == 1: Item
Example of Usage
SetLocation( srcChar, 1000, 1000, 0, 0 );

 

GetID
Prototype
short GetID( int trgItem, int type );
PurposeReturns the ID of the item
type == 0: Char
type == 1: Item
Example of Usage
iID = GetID( srcItem, 1 );

 

GetColour
Prototype
short GetColour( int trgItem, int type );
PurposeReturns the colour of trgItem
type == 0: Char
type == 1: Item
Example of Usage
iColour = GetColour( srcItem, 1 );

 

GetOwner
Prototype
int GetOwner( int trgItem, int type );
PurposeReturns the char (as index) that owns the item. -1 if no owner
type == 0: Char
type == 1: Item
Example of Usage
own = GetOwner( srcItem, 1 );

 

SetX
Prototype
SetX( trgObj, newXLoc, objType );
PurposeSets trgObj's X location to newXLoc
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
SetX( srcChar, 1000, 0 );

 

SetY
Prototype
SetY( trgObj, newYLoc, objType );
PurposeSets trgObj's Y location to newYLoc
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
SetY( srcChar, 1000, 0 );

 

SetZ
Prototype
SetZ( trgObj, newZLoc, objType );
PurposeSets trgObj's Z location to newZLoc
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
SetZ( srcChar, -8, 0 );

 

SetID
Prototype
SetID( trgObj, newID, objType );
PurposeSets trgObj's ID to newID
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
SetID( srcChar, 0x0190, 0 );

 

SetColour
Prototype
SetColour( trgObj, newColour, objType );
PurposeSets trgObj's colour to newColour
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
SetColour( srcChar, 0x0001, 0 );

 

SetOwner
Prototype
SetOwner( trgObj, newOwner, objType );
PurposeSet's trgObj's owner value to newOwner
objType == 0: trgObj is a character
objType == 1: trgObj is an item
Example of Usage
var nOwner = GetOwner( srcObj, 0 );
SetOwner( trgObj, nOwner, 1 );

 

DoDamage
Prototype
DoDamage( trgObj, amtToDamage, objType );
PurposeDoes amtToDamage amount of damage to trgObj
objType == 0: trgObj is a char
objType == 1 : trgObj is an item
Doing a negative amount can heal
Example of Usage
DoDamage( trgObj, 5, 0 );

 

GetVisible
Prototype
int GetVisible( trgObj, objType );
PurposeReturns visibility of an object, varies depending on objType
objType == 0: trgObj is a char, 0 indicates visible, 1 indicates hidden, 2 indicates stealth
objType == 1: trgObj is an item, 0 indicates visible, 1 indicates owner/GM, 2 indicates GM only
Example of Usage
iVis = GetVisible( srcItem, 1 );

 

SetVisible
Prototype
SetVisible( trgObj, trgVis, objType );
PurposeSet's trgObj's visibility to trgVis
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
SetVisible( srcChar, 0, 0 );

 

Delete
Prototype
Delete( trgObj, objType );
PurposeDelete's trgObj
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
Delete( srcChar, 0 );

 

NewScriptTrigger
Prototype
NewScriptTrigger( trgObj, newTrigger, objType );
PurposeSets trgObj's trigger to newTrigger
objType == 0: trgObj is a character
objType == 1: trgObj is an item
Example of Usage
NewScriptTrigger( trgChar, 0, 0 );

 

GetSerial
Prototype
int GetSerial( trgObj, objType );
PurposeReturns serial of an object
objType == 0 indicates a character
objType == 1 indicates an item
Example of Usage
iSerial = GetSerial( srcItem, 1 );

 

SetSerial
Prototype
SetSerial( trgObj, newSerial, objType );
PurposeSet's trgObj's serial to newSerial
objType == 0: trgObj is a char
objType == 1: trgObj is an item
Example of Usage
SetSerial( srcChar, 1, 0 );

 

GetHealth
Prototype
short GetHealth( trgChar, objType );
PurposeReturns the health of trgChar
objType == 0 indicates a character
objType == 1 indicates an item
Example of Usage
hp = GetHealth( srcChar, 0 );

 

SetHealth
Prototype
SetHealth( trgObj, newHealth, objType );
PurposeSets the health of trgObj to newHealth
objType == 0 indicates a character
objType == 1 indicates an item
Example of Usage
SetHealth( srcChar, 0, 0 );

 

GetPrivateBit
Prototype
GetPrivateBit( tObj, objType, mWord, mBit );
PurposeReturns the mBit'th bit of the mWord'th word of tObj. If objType is 0, then tObj is a character, otherwise it's an item
Example of Usage
if( GetPrivateBit( iUsed, 1, 0, 0 ) ) // if first bit is set

{
TextMessage( pUser, "Hello world" );
}

 

SetPrivateBit
Prototype
SetPrivateBit( tObj, objType, mWord, mBit, bOn );
PurposeSets the mBit'th bit of the mWord'th word of tObj to 1 if bOn is true, otherwise 0. If objType is 0, then tObj is a character, otherwise it's an item
Example of Usage
SetPrivateBit( iUsed, 1, 0, 0, true );

 

GetPrivateWord
Prototype
GetPrivateBit( tObj, objType, mWord );
PurposeReturns the mWord'th word of tObj. If objType is 0, then tObj is a character, otherwise it's an item
Example of Usage
if( GetPrivateWord( iUsed, 1, 0 ) == 0 )

{
TextMessage( pUser, "Hello world" );
}

 

SetPrivateWord
Prototype
SetPrivateBit( tObj, objType, mWord, mVal );
PurposeSets the mWord'th word of tObj to mVal. If objType is 0, then tObj is a character, otherwise it's an item
Example of Usage
SetPrivateWord( iUsed, 1, 0, 0 );

 

GetPrivateBitRange
Prototype
GetPrivateBitRange( tObj, objType, mWord, mLow, mHigh );
PurposeReturns the values of the bits mLow through mHigh of the mWord'th word of tObj. If objType is 0, then tObj is a character, otherwise it's an item
Example of Usage
if( GetPrivateBitRange( iUsed, 1, 0, 0, 7 ) == 0 )

{
TextMessage( pUser, "Hello world" );
}

 

SetPrivateBitRange
Prototype
SetPrivateBit( tObj, objType, mWord, mLow, mHigh, mVal );
PurposeSets the bits mLow through mHigh of the mWord'th word of tObj to mVal. If objType is 0, then tObj is a character, otherwise it's an item
Example of Usage
SetPrivateBitRange( iUsed, 1, 0, 0, 7, 128 );

 

GetWorldNumber
Prototype
GetWorldNumber( tObj, objType );
PurposeReturns the world number that tObj is in. If objType is 0, then tObj is a char, otherwise it's an item.
Example of Usage
if( GetWorldNumber( pTalking, 0 ) == 2 )

{
TextMessage( pTalkingTo, "Hello Ilshenar!" );
}

 

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