# UOX3 Script Engine

### API and Event handling

### Character and Item common functions

ApplySection
Prototype |
    ApplySection( scriptSection );
Purpose | Applies a DFN section to an item/character
Example of Usage |
    object.ApplySection( "orcishlord" );

SetLocation
Prototype |
    SetLocation( short targX, short targY, SCHAR targZ );
Purpose | Moves the object to (targX, targY, targZ )
Example of Usage |
    object.SetLocation( 1000, 1000, 0, 0 );

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 );
Purpose | In 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 |
    myItem.Teleport( 4467, 1284, 5 ); //the object will be sent to moonglow

Delete
Prototype |
    Delete();
Purpose | Delete's the object
Example of Usage |
    object.Delete();

FirstItem
Prototype |
    void FirstItem();
Purpose | Returns a handle to the first item in the container. If it's null, then there are no items.
Example of Usage |
    function onUseChecked( pUser, iUsed )
    {
    	var mItem;
    	for( mItem = someCont.FirstItem(); !someCont.FinishedItems(); mItem = someCont.NextItem() )
    	{
    		if( mItem != null )
    		{
    			if( mItem.id == 0x0eed ) //Gold, gold, gold!
    				pUser.SysMessage( "I'm carrying "+mItem.amount+" gold coins! I'm rich!" );
    		}
    	}
    }

NextItem
Prototype |
    void NextItem();
Purpose | Returns the next item found in the container
Example of Usage |
    SEE ABOVE FUNCTION

FinishedItems
Prototype |
    bool FinishedItems();
Purpose | Returns true if there are no more items left to look through
Example of Usage |
    SEE ABOVE FUNCTION

TextMessage
Prototype |
    void TextMessage( string message );
Purpose | Causes the object to say message.
Example of Usage |
    myObject.TextMessage( "The world is great!" );

DistanceTo
Prototype |
    unsigned short DistanceTo( object );
Purpose | Returns the distance to the object.
Example of Usage |
    mObj.DistanceTo( ourObj );

{p}

GetTag
Prototype |
    tagdata GetTag( "TagName" );
Purpose | Returns the tag with the name TagName stored on Object. Note: The Tags you store on Objects are persistent, that means they're stored in the worldsave. The Tags could contain anything, but you should be careful with storing Character and Item objects in there, better store the Serial returned by GetSerial(...).
Example of Usage |
    var TagValue = myObj.GetTag( "LastObject" );

GetNumTags
Prototype |
    int GetNumTags();
Purpose | Returns the number of Tags assigned to Object. Note: The Tags you store on Objects are persistent, that means they're stored in the worldsave. The Tags could contain anything, but you should be careful with storing Character and Item objects in there, better store the Serial returned by GetSerial(...).
Example of Usage |
    var NumberofTags = mObj.GetNumTags();

SetTag
Prototype |
    void SetTag( "TagName", "TagValue" );
Purpose | Sets a new Value for the Tag called "TagName" on Object. To retrieve this Value use GetTag. Note: If you want to store a value with decimals, you have to store it as a string. Note: The Tags you store on Objects are persistent, that means they're stored in the worldsave. The Tags could contain anything, but you should be careful with storing Character and Item objects in there, better store the Serial returned by GetSerial(...).
Example of Usage |
    var TagValue = "ItWork!"
    mObj.SetTag( "LastObject", TagValue );

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

Resist
Prototype |
    int Resist( type );
    void Resist( type, value );
Purpose | Gets and sets the resistance values of a char or item. Types are: Armor Light Water Cold Heat Energy Poison
Example of Usage |
    Set the Armor value of an item to 25:
    mItem.Resist( 1, 25 );

    Get the armor value of an item:
    value = mItem.Resist( 1 );

CanSee
Prototype |
    bool CanSee( object );
    bool CanSee( x, y, z );
Purpose | LineOfSight-checking; check if character/socket can see a specified object/target location
Example of Usage |
    if( !myChar.CanSee( targetChar ))
    	return;

    if( myChar.CanSee( targetChar.x, targetChar.y, targetChar.z )
    {
    	//Do stuff!
    }

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