UOX3 Script Engine

Functions, Methods, Properties and Event handling

Item Related Methods

 

CreateDFNItem
Prototype
ITEM CreateDFNItem( socket, character, sectionToMake, [int Amount], [objectType], [bool inPack] );
PurposeSpawns an item from a DFN section number/id.
NotesParameters:
socket - socket to refresh to (and ensure weight is added)
character - required to know the pack/character to spawn it to
sectionToMake - section # to spawn from
int Amount - Amount of items to spawn (Optional)
objectType - specify the type of object being added: "BASEOBJ" "CHARACTER", "ITEM", "SPAWNER", "MULTI", "BOAT"
bool inPack - True/false whether to spawn in pack or not (Optional - default is FALSE).
Example of Usage
function onUseChecked( pUser, iUsed )
{
	var myItem = CreateDFNItem( pUser.socket, pUser, "0x09d0", 10, "ITEM", true );
	pUser.SysMessage( "Oh my, 10 apples just appeared in my backpack! Magic!" );
}

 

CreateBlankItem
Prototype
ITEM CreateBlankItem( socket, character, amount, itemName, itemID, colour, objectType, inPack );
PurposeSpawns a "blank" item with values from the UO client's tiledata file.
NotesParameters:
socket - socket to refresh to (and ensure weight is added)
character - required to know the pack/character to spawn it to
amount - The amount of items to spawn
itemName - the name to give to the newly spawned item
itemID - itemID(hex) to spawn item from
colour - colour of the spawned item
objectType - specify the type of object being added: "BASEOBJ" "CHARACTER", "ITEM", "SPAWNER", "MULTI", "BOAT"
inPack - True/false whether to spawn in pack or not
bSend - Whether or not to send update to all players
Example of Usage
function onUseChecked( pUser, iUsed )
{
	var myItem = CreateBlankItem( pUser.socket, pUser, 10, "apple", 0x09d0, 0x0, "ITEM", true );
	pUser.SysMessage( "Oh my, 10 apples just appeared in my backpack! Magic!" );
}

 

GetSerial
Prototype
int GetSerial( part );
PurposePart have to be between 1 and 4.
Example of Usage
iSerial = myItem.GetSerial( 1 );

 

HasSpell
Prototype
bool HasSpell( spellNum );
PurposeScans through player's contents to see if they have spellNum in the first spellbook encountered
Example of Usage
if(myPlayer.HasSpell( 0 )==1);

 

InRange
Prototype
int InRange( trgObj, srcType, trgType, distance );
PurposesrcType and trgType are like objType for other funcs. 0 indicates a char, 1 indicates an item.
Returns true if the distance from srcObj to trgObj is less than distance
Example of Usage
if(myItem.InRange( trgItem, 0, 1, 18 );

 

KillTimers
Prototype
void Killtimers( );
PurposeKills all timers of the Char.
Example of Usage
myItem.KillTimers;

 

LockDown
Prototype
void LockDown( );
PurposeLocks item down (sets movable value to 3).
Example of Usage
myItem.LockDown();

 

OpenPlank
Prototype
void OpenPlank( void )
PurposeOpens the plank of a boat.
Example of Usage
myPlank.OpenPlank()

 

RemoveSpell
Prototype
void RemoveSpell( spellNum );
PurposeRemoves spellNum from player's spellbook
Example of Usage
myItem.RemoveSpell( 0 );

 

SetCont
Prototype
void SetCont( object );
PurposeSets the container of the item to the specified object.
Example of Usage
myItem.SetCont( mChar );

 

SetPoison
Prototype
void SetPoison ( poisonLevel );
PurposeSets a specified level of posion for an item/weapon.
Example of Usage
myItem.SetPoison( 2 );
//Applies level 2 poison to item

 

SoundEffect
Prototype
void SoundEffect( soundID, bAllHear );
PurposePlays a sound from Character. SoundID is the full ID of the sound to play. If bAllHear is TRUE, then everyone nearby hears it. If it's false, then only the Character hears it. NOTE: Soundlist
Example of Usage
myItem.SoundEffect( 568, TRUE );

 

StartTimer
Prototype
void StartTimer( numMiliSec, timerID, callBack );
PurposeStarts a timer that will elapse after numHundredthsOfSec seconds pass, for an item tItem. timerID must be between 0 and 100. Resulting onTimer event will be triggered. Which script it triggers in depends on the (optional, defaults to false) third parameter, which can be true (calls back to existing script), false (calls back into object's script) or an int (scriptID to call back to). This optional parameter defaults to false if not specified.
Example of Usage
myItem.StartTimer( 600, 0, true );
myChar.StartTimer( 1200, 0, false ); //Timer calls back to existing script
myChar.StartTimer( 1200, 0, 2012 ); //Timer calls back to script with ID 2012

 

Glow
Prototype
void Glow( socket );
PurposeCauses the object to begin glowing.
Example of Usage
myItem.Glow( pSock );

 

UnGlow
Prototype
void UnGlow( socket );
PurposeCauses the object to stop glowing.
Example of Usage
myItem.UnGlow( pSock );

 

PlaceInPack
Prototype
void PlaceInPack();
PurposeRandomly sets the placement of an item inside the container it is in.
Example of Usage
myItem.PlaceInPack();

 

Dupe
Prototype
void Dupe( socket );
PurposeCreates a duplicate of the item.
Example of Usage
myItem.Dupe( mySock );

 

Carve
Prototype
void Carve( socket );
Purpose Makes the character belonging to socket carve up a corpse
Example of Usage
myCorpse.Carve( socket );

 

Refresh
Prototype
void Refresh();
Purpose Causes the item to be refreshed to sockets that can see it
Example of Usage
myItem.Refresh();

 

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