UOX3 Script Engine

Functions, Methods, Properties and Event handling

Character Related Methods

 

TextMessage
Prototype
void TextMessage( message );
PurposeCauses the char to say message.
Example of Usage
myChar.TextMessage( "The world is great!" );

 

EmoteMessage
Prototype
void EmoteMessage( message );
PurposeCauses the Char to emote message. You have to put the start and end * manually in!
Example of Usage
myChar.EmoteMessage( "*looks around*" );

 

Delete
Prototype
void Delete( );
PurposeDelete's the Char.
Example of Usage
myChar.Delete( );

 

DoAction
Prototype
void DoAction( trgAction );
PurposeMakes Char do action trgAction.
NOTE: Anyone got a list of the possible actions?
Example of Usage
myChar.DoAction( 0x0B );

 

StaticEffect
Prototype
void StaticEffect( Effect, speed, loop );
PurposeDoes a static effect for a char.
NOTE: Anyone got a list of the possible effects?
Example of Usage
MyChar.StaticEffect( 0x376A, 9, 6 );

 

Teleport
Prototype
This method could eiter take 1,2,3 or 4 parameter:
void Teleport( togoto );
void Teleport( x, y );
void Teleport( x, y, z );
void Teleport( x, y, z, world );
PurposeIn the first Method you need a string, including x, y, z and Worldnumber. NOTE: Anyone exact informations about the string?
If you don't give the z-coordinate/worldnumber the actual z-coordinate/worldnumber will be taken.
Worldnumber 0=Trammel, Worldnumber 1= Felucca.
Example of Usage
myChar.Teleport( 4467,1284,5, ); //the Char will be sent to moonglow

 

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.
Example of Usage
myChar.SoundEffect( 568, TRUE );

 

SellTo
Prototype
void SellTo( targNPC );NOTE: Not Correct
PurposeBrings up the shopkeeper gump for selling to a vendor targNPC by tSock.
Example of Usage
myChar.ToSell( myNpc );

 

BuyFrom
Prototype
VendorBuy( tSock, targNPC );NOTE: Not Correct
PurposeBrings up the shopkeeper gump or PV backpack for buying for vendor targNPC.
Example of Usage
VendorBuy( CalcSockFromChar( pTalking ), pTalkingTo );

 

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);

 

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

 

GetTag
Prototype
tagdata GetTag( TagToGet);
PurposeReturns the value of the TagToGet Tag.
Example of Usage
if( myChar.GetTag(quest1)==1)
{
myChar.TextMessage("You have already performed this quest.");
}

 

SetTag
Prototype
void SetTag( TagName, TagValue );
PurposeSet the value of the Tag TagName to TagValue.
Example of Usage
myChar.SetTag( "quest1", 1 );

 

OpenBank
Prototype
void OpenBank( trgSock );
PurposeOpen's Char's bank, sending it to trgSock
Example of Usage
myPlayer.OpenBank(trgSock);

 

DirectionTo
Prototype
unsigned char DirectionTo( pCheck, pType );
PurposeReturns the direction that pCheck is facing. If pType == 0, pCheck is a character. If pType == 1, pCheck is an item
Example of Usage
if( GetDir( pTalking, 0 ) >= 0x80 )

{
TextMessage( pTalkingTo, "Jinkies, you're running!" );
}

 

TurnToward
Prototype
void TurnToward( trgChar );
PurposeChar turns to trgChar.
Example of Usage
myNPC.TurnToward( myPlayer );

 

ResourceCount
Prototype
int ResourceCount( realitemid, colour );
PurposeReturns the amount of the items with the realitemid and the according colour.
Example of Usage
if(myChar.ResourceCount( 0x1BF2, 0 ));

 

UseResource
Prototype
void UseResource( amount, realitemid );
void UseResource( amount, realitemid, colour );
PurposeRemoves amout Items with of the ID realitemid.
Example of Usage
myChar.UseResource( 5, 0x1BF2, 0 );

 

CustomTarget
Prototype
void CustomTarget( tNum, toSay );
PurposeVery similar to PopUpTarget. It's a callback situation instead. tNum must be between 0 and 255. Says toSay, and shows a cursor. Reenters the script associated with the socket's player (ie player who gets the cursor). Enters function name based on the value of tNum. if tNum is 0, then the function would be onCallback0. Prototype of callback is:
function onCallback0( tSock, targSerial )
Example of Usage
myChar.CustomTarget( 0, "Select your custom target:" );

 

PopUpTarget
Prototype
void PopUpTarget( tNum, toSay );
PurposeProvides a call to an inbuilt popup target. tNum must be between 0 and 255 inclusive. Says toSay, and shows a cursor. Note that this allows access potentially to GM functions.
Example of Usage
myChar.PopUpTarget( 2, "Where do you wish to teleport to?" );

 

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(myChar.InRange( trgItem, 0, 1, 18 ));

 

FindItemLayer
Prototype
*Item FindItemLayer( layer );
PurposeA 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
lefthand=myChar.FindItemLayer(1);

 

StartTimer
Prototype
void StartTimer( numMiliSec, timerID );
PurposeStarts a timer that will elapse after numHundredthsOfSec seconds pass, for a character tChar. timerID must be between 0 and 100. Resulting onTimer event will be triggered.
Example of Usage
myChar.StartTimer( 600, 0 );

 

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

 

CheckSkill
Prototype
bool CheckSkill( skillnum, minskill, maxskill );
PurposeReturns true if the skill skillnum is between min and may skill.
Example of Usage
if( myChar.CheckSkill( 1, 200, 1000))

 

SpeechInput
Prototype
void SpeechInput( speechID );
PurposeCalls up the onSpeechInput event with the
text the user types.
Example of Usage
myChar.SpeechInput( 1 );

 

Freeze
Prototype
void Freeze( );
PurposeFreezes Char, stopping them from moving
Example of Usage
myChar.Freeze( );

 

Unfreeze
Prototype
void Unfreeze( );
PurposeUnfreezes Char, allowing them to move again
Example of Usage
myChar.Unfreeze( );

 

CastSpell
Prototype
void CastSpell( spellNum );
PurposeCauses character to cast spellNum. Character can be an NPC or PC. spellNum can be any valid spellNum (0=>63).
Example of Usage
myChar.CastSpell( 32 );

 

SysMessage
Prototype
void SysMessage( string message );
PurposeSends a string as a sysmessage.
Example of Usage
myChar.SysMessage( "Isn't the world great?" );

 

MagicEffect
Prototype
void MagicEffect( spellID );
PurposeCauses the visual effects of the specified spell to be applied to the character.
Example of Usage
myChar.MagicEffect( 43 );

 

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

 

MakeMenu
Prototype
void MakeMenu( mnu );
PurposeOpens up make menu mnu and sends it to sock
Example of Usage
myChar.MakeMenu( 1 );

 

WanderBox
Prototype
void WanderBox( x1, y1, x2, y2 );
PurposeForces the npc to wander in the box of coordinates specified.
Example of Usage
myNPC.WanderBox( 5593, 1203, 5608, 1206 );

 

Follow
Prototype
void Follow( newmaster );
PurposeForces the char to follow the new master.
Example of Usage
myNPC.Follow( myChar );

 

Dismount
Prototype
void Dismount();
PurposeDismounts a char.
Example of Usage
myChar.Dismount();

 

SetPoisoned
Prototype
void SetPoisoned( poisonLevel, Length )
PurposeApplies a specified level of poison to a character for a specified amount of time (in milliseconds).
Example of Usage
myChar.SetPoisoned( 2, 10000 );
//Gives myChar a 2nd level poison for 10 seconds.

 

ExplodeItem
Prototype
void ExplodeItem( myItem );
PurposeDeletes specified item with an explode sound.
Example of Usage
myChar.ExplodeItem( myItem );

 

SetInvisible
Prototype
void SetInvisible( visibility, timeLength )
PurposeSets character to the specified visibility level for the specified amount of time (in milliseconds). NOTE: Timer seems to be broken, as character stays hidden forever.
Example of Usage
myChar.SetInvisible( 1, 1000 );

 

SpawnNPC
Prototype
var CHARACTER = SpawnNPC( bpSocket, sectionID, x, y, z, worldnumber )
PurposeSpawns a character from a DFN entry (sectionID)
ParametersbpSocket - The socket of the character to add with (although this can be null)
sectionID - The entry # in npc-DFNs to spawn from.
x, y and z - The target location to spawn at
worldNumber - The world that it will spawn in (0 == britannia, 2 == ilshenar)
Example of Usage
function onUse( pUser, iUsed )
{
	var nSpawned = SpawnNPC( null, "brownhorse", pUser.x, pUser.y, pUser.z, pUser.worldnumber );
	pUser.SysMessage( "Wheee - a brown horse just spawned at my location!" );
}

 

Original: ©Copyright 2000-2001 WWW.UOX3.NET (Daniel Stratton/Matthew Randall) ||| Rewrite: ©Copyright 2002 WWW.UOXDEV.DE (Florian "Rukus" Frick)