| RollDice | ||
|---|---|---|
| Prototype | int RollDice( numDie, faces, addition ); | |
| Purpose | Rolls a faces sided die numDie times and adds addition. The example is for a DnD style dice like: 2d3+1 | |
| Example of Usage | var mDie = RollDice( 2, 3, 1 ); | |
| ScriptPrintNumber | ||
|---|---|---|
| Prototype | ScriptPrintNumber( number ); | |
| Purpose | Prints out a number to the console | |
| Example of Usage | ScriptPrintNumber( 5 ); | |
| SetShowLayer | ||
|---|---|---|
| Prototype | SetShowLayer( number ); | |
| Purpose | Sets showlayer true (if number == 1) or false | |
| Example of Usage | SetShowLayer( 1 ); | |
| GetShowLayer | ||
|---|---|---|
| Prototype | int GetShowLayer(); | |
| Purpose | Returns value of showlayer | |
| Example of Usage | var iLayer = GetShowLayer(); | |
| RandomNumber | ||
|---|---|---|
| Prototype | int RandomNumber( loNum, hiNum ); | |
| Purpose | Returns a random number between loNum and hiNum | |
| Example of Usage | var iNum = RandomNumber( 0, 10 ); | |
| CalcCharFromSer | ||
|---|---|---|
| Prototype | CHARACTER CalcCharFromSer( cSerial ); | |
| Purpose | Returns the item with serial cSerial. Returns null if it doesn't exist | |
| Example of Usage | var trgChar = CalcCharFromSer( cSerial ); | |
| CalcItemFromSer | ||
|---|---|---|
| Prototype | ITEM CalcItemFromSer( iSerial ); | |
| Purpose | Returns the item with serial iSerial. Returns null if it doesn't exist | |
| Example of Usage | var trgItem = CalcItemFromSer( iSerial ); | |
| RegisterKey | ||
|---|---|---|
| Prototype | ||
| Purpose | ||
| Example of Usage | ||
| UnregisterKey | ||
|---|---|---|
| Prototype | ||
| Purpose | ||
| Example of Usage | ||
| GetMurderThreshold | ||
|---|---|---|
| Prototype | int GetMurderThreshold(); | |
| Purpose | Returns the number of kills needed to go red. | |
| Example of Usage | if( GetMurderThreshold() > GetMurderCount( pTalking ) ) | |
| GetTileIDAtMapCoord | ||
|---|---|---|
| Prototype | char DirectionTo( xLoc, yLoc, worldNumber ); | |
| Purpose | Returns ID of the tile at xLoc and yLoc in world worldNumber | |
| Example of Usage |
var MapTile = GetTileIDAtMapCoord( 0, 0, 0 ); // gets tile at 0,0 in Britannia | |
| TriggerEvent | ||
|---|---|---|
| Prototype | TriggerEvent( scriptID, "functionName", argument1, argument2 ); | |
| Purpose | Calls the JScript that uses scriptID, runs function which is called "functionName", along with the arguments defined afterwards, seperated by commas. | |
| Example of Usage |
TriggerEvent( 8000, "onUseChecked", pUser, pItem ); | |
| AreaCharacterFunction | ||
|---|---|---|
| Prototype | AreaCharacterFunction( "myAreaFunc", radiusObject, radius, socket ); | |
| Purpose | Allows script to work with every character that is found in the radius of the radiusObject (item or character), for the purpose of area-effects. | |
| Example of Usage |
function onUseChecked( pUser, pSock );
{
AreaCharacterFunction( "myAreaFunc", pUser, 10, pSock );
}
function myAreaFunc( srcChar, trgChar, pSock )
{
trgChar.TextMessage( "Oh no I've been found!" );
pSock.SysMessage( "Found " + trgChar.name );
} | |
| AreaItemFunction | ||
|---|---|---|
| Prototype | AreaItemFunction( "myAreaFunc", radiusObject, radius, socket ); | |
| Purpose | Allows script to work with every item that is found in the radius of the radiusObject (item or character), for the purpose of area-effects. | |
| Example of Usage |
function onUseChecked( pUser, pSock );
{
AreaItemFunction( "myAreaFunc", pUser, 10, pSock );
}
function myAreaFunc( srcChar, trgItem, pSock )
{
trgItem.TextMessage( "Oh no I've been found!" );
pSock.SysMessage( "Found " + trgItem.name );
} | |
| UseDoor | ||
|---|---|---|
| Prototype | UseDoor( iSock, iToUse ); | |
| Purpose | Uses the door iToUse. iSock is used for message display. If unknown, use -1. | |
| Example of Usage | if( GetType( iUsed ) == 12 ) | |
| SendStaticStats | ||
|---|---|---|
| Prototype | void SendStaticStats( socket ); | |
| Purpose | Builds a gump with map and tile information on the targeted location. | |
| Example of Usage | SendStaticStats( mSock ); | |
| GetTileHeight | ||
|---|---|---|
| Prototype | signed char GetTileHeight( tileID ); | |
| Purpose | Returns the map height of the specified tile. | |
| Example of Usage | object.z = GetTileHeight( targTile ); | |
| IterateOver | ||
|---|---|---|
| Prototype | unsigned int IterateOver( objectType ); | |
| Purpose | Iterates over all objects of specified type in the world. | |
| Extra Info | For every object it comes across, the iterator will call onIterate( object ) in the calling script. | |
| Example of Usage | var count = IterateOver( "ITEM" );
function onIterate( toCheck )
{
toCheck.TextMessage( "I'm an item!" );
return true;
}
| |
| WorldBrightLevel | ||
|---|---|---|
| Prototype | unsigned char WorldBrightLevel( [lightlevel] ); | |
| Purpose | Sets and returns the bright light level of the world. | |
| Example of Usage | WorldBrightLevel( 1 ); | |
| WorldDarkLevel | ||
|---|---|---|
| Prototype | unsigned char WorldDarkLevel( [lightlevel] ); | |
| Purpose | Sets and returns the dark light level of the world. | |
| Example of Usage | var darkLight = WorldDarkLevel(); | |
| WorldDungeonLevel | ||
|---|---|---|
| Prototype | unsigned char WorldDungeonLevel( [lightlevel] ); | |
| Purpose | Sets and returns the dungeon light level of the world. | |
| Example of Usage | WorldDungeonLevel( 1 ); | |
| ValidateObject | ||
|---|---|---|
| Prototype | bool ValidateObject( object ); | |
| Purpose | Returns true if argument is validated as an object | |
| Example of Usage | if( !ValidateObject( pUser ) ) return; | |
| ReloadJSFile | ||
|---|---|---|
| Prototype | void ReloadJSFile( scriptID ); | |
| Purpose | Reloads a specified JavaScript file depending on scriptID from jse_fileassociations.scp | |
| Example of Usage |
function CommandRegistration()
{
RegisterCommand( "reloadjsfile", 3, true ); //Reload JavaScript file
}
function command_RELOADJSFILE( socket, cmdString )
{
var scriptID = parseInt( cmdString );
socket.SysMessage( "Attempting Reload of JavaScript (ScriptID " + cmdString + ")" );
ReloadJSFile( scriptID );
}
| |
| GetTimer | ||
|---|---|---|
| Prototype | bool GetTimer( timerID ); | |
| Purpose | Returns the specified timer value | |
| Example of Usage | myObj.GetTimer( 3 ); | |
| SetTimer | ||
|---|---|---|
| Prototype | bool SetTimer( timerID, numMilliSeconds ) | |
| Purpose | Sets the specified timer with the amount of miliseconds until it expires. | |
| Example of Usage | mySock.SetTimer( 3, 1000 ); | |
| Moon | ||
|---|---|---|
| Prototype | bool Moon( moonNum, newVal ); | |
| Purpose | Get and set the server moon values for the two moons Felucca (0) and Trammel (1) | |
| Example of Usage | var feluccaMoonphase = Moon( 0 ); var TrammelMoonphase = Moon( 1 ); Moon( 0, 7 ); //Set the moon Felucca to moonphase 7 Moon( 1, 3 ); //Set the moon Trammel to moonphase 3 | |
| CreateParty | ||
|---|---|---|
| Prototype | bool CreateParty( partyleader ); | |
| Purpose | Create a new party/group with the specified character as leader | |
| Example of Usage | var myParty = CreateParty( pUser ); //create a new party (myParty) with pUser as the leader | |
| GetSocketFromIndex | ||
|---|---|---|
| Prototype | bool GetSocketFromIndex( socketIndex ); | |
| Purpose | Create a socket-object based on the specified socketIndex | |
| Example of Usage | var socket = GetSocketFromIndex( 0 ); //fetch whatever socket is connected to the server as socket/connection 0 | |