GetTag | ||
---|---|---|
Prototype |
variant GetTag( Object, ObjectType, "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 = GetTag( srcChar, 0, "LastObject" ); |
GetNumTags | ||
---|---|---|
Prototype |
variant GetNumTags( Object, ObjectType); | |
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 = GetNumTags(srcChar, 0); |
SetTag | ||
---|---|---|
Prototype |
variant SetTag( Object, ObjectType, "TagName", "" ); | |
Purpose | Sets a new Value for the Tag called "TagName" on Object. To
retrieve this Value use GetTag. 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!"; |
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 ); |
StartTimer | ||
---|---|---|
Prototype | StartTimer( tChar, numSecs, numHundredthsOfSec, timerID ); | |
Purpose | Starts a timer that will elapse after numSecs and numHundredthsOfSec seconds pass, for a character tChar. timerID must be between 0 and 100. Resulting onTimer event will be triggered. | |
Example of Usage | StartTimer( srcChar, 1, 0, 0 ); |
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(); |
CalcSockFromChar | ||
---|---|---|
Prototype | UOXSOCKET CalcSockFromChar( int trgChar ); | |
Purpose | Returns the socket associated with a particular character, or -1 if not online | |
Example of Usage | srcSock = CalcSockFromChar( srcChar ); |
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 | int CalcCharFromSer( cSerial ); | |
Purpose | Returns the index of the item with serial cSerial. Returns -1 if it doesn't exist | |
Example of Usage | var trgChar = CalcCharFromSer( cSerial ); |
CalcItemFromSer | ||
---|---|---|
Prototype | int CalcItemFromSer( iSerial ); | |
Purpose | Returns the index of the item with serial iSerial. Returns -1 if it doesn't exist | |
Example of Usage | var trgItem = CalcItemFromSer( iSerial ); |
DistanceTo | ||
---|---|---|
Prototype | int DistanceTo( srcObj, trgObj, srcType, trgType ); | |
Purpose | srcType and trgType are like objType for other funcs.0 indicates a char, 1 indicates an item. Returns the distance measured from srcObj to trgObj | |
Example of Usage | var iDist = DistanceTo( srcChar, trgItem, 0, 1 ); |
InRange | ||
---|---|---|
Prototype | int InRange( srcObj, trgObj, srcType, trgType, distance ); | |
Purpose | srcType 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 | var isInRange = InRange( srcChar, trgItem, 0, 1, 18 ); |
CalcCharFromSock | ||
---|---|---|
Prototype | int CalcCharFromSock( sockNum ); | |
Purpose | Calculates the character associated with a socket | |
Example of Usage | var plChar = CalcCharFromSock( sockNum ); |
RegisterKey | ||
---|---|---|
Prototype | ||
Purpose | ||
Example of Usage |
UnregisterKey | ||
---|---|---|
Prototype | ||
Purpose | ||
Example of Usage |
GetLightLevel | ||
---|---|---|
Prototype | int GetLightLevel( player ); | |
Purpose | Returns the light level that player sees | |
Example of Usage | var ilevel = GetLightLevel( pTalkingTo ); |
GetMurderThreshold | ||
---|---|---|
Prototype | int GetMurderThreshold(); | |
Purpose | Returns the number of kills needed to go red. | |
Example of Usage | if( GetMurderThreshold() > GetMurderCount( pTalking ) ) |
DirectionTo | ||
---|---|---|
Prototype | char DirectionTo( srcChar, xToTurnTo, yToTurnTo ); | |
Purpose | Returns the direction that srcChar would face if he was turning to xToTurnTo/yToTurnTo | |
Example of Usage | var mDir = DirectionTo( pTalking, GetX( pTalkingTo, 0 ), GetY( pTalkingTo, 0 ) ); |
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, "onUse", pUser, pItem ); |
AreaCharacterFunction | ||
---|---|---|
Prototype | AreaCharacterFunction( "myAreaFunc", radiusObject, radius, socket ); | |
Purpose | Allows script to work with every that is found in the radius of the radiusObject (item or character), for the purpose of area-effects. | |
Example of Usage |
function onUse( 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 ); } |