From ad394e1f0ccf7d4038d291d38ec7c322ef39a077 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:54:36 -0500 Subject: [PATCH] CheckInstaLog Added Added the CheckInstaLog function to check if a specific location is within an instant logout zone (SEFunctions.cpp). --- docs/jsdocs.html | 1167 +++++++++++++++++++++------------------- source/Changelog.txt | 3 + source/SEFunctions.cpp | 40 ++ source/SEFunctions.h | 2 + source/cScript.cpp | 1 + 5 files changed, 648 insertions(+), 565 deletions(-) diff --git a/docs/jsdocs.html b/docs/jsdocs.html index 8dbe347a8..98d42d786 100644 --- a/docs/jsdocs.html +++ b/docs/jsdocs.html @@ -6339,80 +6339,113 @@
Prototype
-int BASEITEMSERIAL();
-int INVALIDSERIAL();
-int INVALIDID();
-int INVALIDCOLOUR();
-Purpose
-BASEITEMSERIAL() - Gets the constant that defines the base value used as starting point for item serials. If an object serial is lower than this, it probably belongs to a character. If it's higher, it belongs to an item.
- INVALIDSERIAL() - Gets the constant defining an invalid serial. If an object serial matches this, it's invalid!
- INVALIDID() - Gets the constant defining an invalid ID. If an object's ID matches this, it's probably not a valid ID!
- INVALIDCOLOUR() - Gets the constant defining an invalid colour. If an object's colour is equal or higher than this, it's probably not a valid colour!
Example of usage
-var baseItemSerial = BASEITEMSERIAL();
+
+
+
+
+
+ Prototype
+ int BASEITEMSERIAL();
+ int INVALIDSERIAL();
+ int INVALIDID();
+ int INVALIDCOLOUR();
+
+
+ Purpose
+
+ BASEITEMSERIAL() - Gets the constant that defines the base value used as starting point for item serials. If an object serial is lower than this, it probably belongs to a character. If it's higher, it belongs to an item.
+ INVALIDSERIAL() - Gets the constant defining an invalid serial. If an object serial matches this, it's invalid!
+ INVALIDID() - Gets the constant defining an invalid ID. If an object's ID matches this, it's probably not a valid ID!
+ INVALIDCOLOUR() - Gets the constant defining an invalid colour. If an object's colour is equal or higher than this, it's probably not a valid colour!
+
+
+
+ Example of usage
+ var baseItemSerial = BASEITEMSERIAL();
var invalidSerial = INVALIDSERIAL();
var invalidID = INVALIDID();
var invalidColour = INVALIDCOLOUR();
-
-
-
+
Prototype
-PARTY CreateParty( partyleader );
-Purpose
-Create a new party/group with the specified character as leader
-Example of usage
-// Create a new party (myParty) with pUser as the leader
+
+
+
+
+
+ Prototype
+ PARTY CreateParty( partyleader );
+
+
+ Purpose
+ Create a new party/group with the specified character as leader
+
+
+ Example of usage
+ // Create a new party (myParty) with pUser as the leader
var myParty = CreateParty( pUser );
-
-
-
+
Prototype
-int DistanceBetween( x1, y1, x2, y2 );
-int DistanceBetween( x1, y1, z1, x2, y2, z2 );
-int DistanceBetween( objA, objB );
-int DistanceBetween( objA, objB, checkZ );
-Purpose
-Get the distance between two sets of coordinates or objects on either 2D or 3D plane
-Notes
-Parameters: x1, y1, z1, x2, y2, z2 = coordinates
- checkZ = true if distance between two objects should take into account Z axis
Example of usage
-// Get distance between two sets of x, y coordinates
+
+
+
+
+
+ Prototype
+ JSBool CheckInstaLog( x, y, world, instanceID );
+
+
+ Purpose
+ Checks if a specific location ( x, y, world, instanceID ) is within an instant logout zone.
+
+
+ Example of usage
+ // Check if the player is in an instant logout zone
+var isInstaLog = CheckInstaLog(targX, targY, worldNumber, instanceID);
+
+if( isInstaLog )
+{
+ // Handle instant logout
+}
+else
+{
+ // Handle other logout scenarios
+}
+
+
+
+
+
+
+
+
+
+ Prototype
+ int DistanceBetween( x1, y1, x2, y2 );
+ int DistanceBetween( x1, y1, z1, x2, y2, z2 );
+ int DistanceBetween( objA, objB );
+ int DistanceBetween( objA, objB, checkZ );
+
+
+ Purpose
+ Get the distance between two sets of coordinates or objects on either 2D or 3D plane
+
+
+ Notes
+
+ Parameters: x1, y1, z1, x2, y2, z2 = coordinates
+ checkZ = true if distance between two objects should take into account Z axis
+
+
+
+ Example of usage
+ // Get distance between two sets of x, y coordinates
var distance1 = DistanceBetween( pUser.x, pUser.y, iUsed.x, iUsed.y );
// Get distance between two sets of x, y, z coordinates
@@ -6423,157 +6456,159 @@ January 9th, 2022
// Get distance between pUser and iUsed using 3D coordinates
var distance2 = DistanceBetween( pUser, iUsed, true );
-
-
-
+
Prototype
-bool DoesEventExist( scriptID, eventToCheck );
-Purpose
-Check for existence of a named JS event/function in another script
-Notes
-Parameters: scriptID = ID of the script to check
- eventToCheck = name of event/function to look for
Example of usage
-// Check if a custom function exists in a specific script (0), and trigger it with TriggerEvent() if it does:
+
+
+
+
+
+ Prototype
+ bool DoesEventExist( scriptID, eventToCheck );
+
+
+ Purpose
+ Check for existence of a named JS event/function in another script
+
+
+ Notes
+
+ Parameters: scriptID = ID of the script to check
+ eventToCheck = name of event/function to look for
+
+
+
+ Example of usage
+ // Check if a custom function exists in a specific script (0), and trigger it with TriggerEvent() if it does:
if( DoesEventExist( 0, "MyCustomFunction" ))
{
TriggerEvent( 0, "MyCustomFunction", [additional parameters] );
}
-
-
-
+
Prototype
-int GetAccountCount();
-Purpose
-Gets the total amount of accounts on the server
-Example of usage
-var totalAccounts = GetAccountCount();
- Prototype
+int GetAccountCount();
+Purpose
+Gets the total amount of accounts on the server
+Example of usage
+var totalAccounts = GetAccountCount();
+ Prototype
-bool GetClientFeature( ClientFeaturesBitNum );
-Purpose
-Check if a specific client features is enabled. For a list of features that can be checked this way, see [settings]->clientFeatures List in the UOX.INI Settings section of the UOX3 Documentation.
-Example of usage
-// AoS bit from list of client features
+
+
+
+
+
+ Prototype
+ bool GetClientFeature( ClientFeaturesBitNum );
+
+
+ Purpose
+ Check if a specific client features is enabled. For a list of features that can be checked this way, see [settings]->clientFeatures List in the UOX.INI Settings section of the UOX3 Documentation.
+
+
+ Example of usage
+ // AoS bit from list of client features
var aosFeaturesEnabled = GetClientFeature( 0x10 );
-
-
-
+
Prototype
-string GetDictionaryEntry( entryNum [, language ] );
-Purpose
-Pulls entry from the dictionary file based on language (or server default, if no language parameter is ).
-Example of usage
-var textString = GetDictionaryEntry( 1, socket.language );
- Prototype
+string GetDictionaryEntry( entryNum [, language ] );
+Purpose
+Pulls entry from the dictionary file based on language (or server default, if no language parameter is ).
+Example of usage
+var textString = GetDictionaryEntry( 1, socket.language );
+ Prototype
-int GetMurderThreshold();
-Purpose
-Returns the number of kills needed to be branded as a murderer and turn red.
-Notes
-See also: Character .murderCount and .murderer properties
-Example of usage
-if( GetMurderThreshold() > pTalking.murderCount )
+
+
+
+
+
+ Prototype
+ int GetMurderThreshold();
+
+
+ Purpose
+ Returns the number of kills needed to be branded as a murderer and turn red.
+
+
+ Notes
+ See also: Character .murderCount and .murderer properties
+
+
+ Example of usage
+ if( GetMurderThreshold() > pTalking.murderCount )
{
TextMessage( pTalkingTo, "Surely sir, you must be a murderer. I bid you adieu" );
EmoteMessage( pTalkingTo, "*scampers off*" );
}
-
-
-
+
Prototype
-int GetPlayerCount();
-Purpose
-Gets the total amount of players online on the server
-Example of usage
-var totalOnlinePlayers = GetPlayerCount();
- Prototype
+int GetPlayerCount();
+Purpose
+Gets the total amount of players online on the server
+Example of usage
+var totalOnlinePlayers = GetPlayerCount();
+ Prototype
-SOSObject GetRandomSOSArea( worldNum, instanceID );
-Purpose
-Gets a random SOS area from list of such areas loaded from [SOSAREAS] section of regions.dfn
-Example of usage
-// Fetch reference to a random SOS area
+
+
+
+
+
+ Prototype
+ SOSObject GetRandomSOSArea( worldNum, instanceID );
+
+
+ Purpose
+ Gets a random SOS area from list of such areas loaded from [SOSAREAS] section of regions.dfn
+
+
+ Example of usage
+ // Fetch reference to a random SOS area
var sosArea = GetRandomSOSArea( pUser.worldNum, pUser.instanceID );
// Pick a random location within the selected sosArea
@@ -6587,112 +6622,112 @@ January 9th, 2022
sosMsg.more = sosMsg.instanceID;
// See UOX3/js/item/waterstainedsos.js for full example, including validation for whether the chosen location is suitable, and not blocked by dynamic items, static items or map tiles
-
-
-
+
Prototype
-bool GetServerFeature( ServerFeaturesBitNum );
-Purpose
-Check if a specific server features is enabled. For a list of features that can be checked this way, see [settings]->serverFeatures List in the UOX.INI Settings section of the UOX3 Documentation.
-Example of usage
-// ContextMenus bit from list of server features
+
+
+
+
+
+ Prototype
+ bool GetServerFeature( ServerFeaturesBitNum );
+
+
+ Purpose
+ Check if a specific server features is enabled. For a list of features that can be checked this way, see [settings]->serverFeatures List in the UOX.INI Settings section of the UOX3 Documentation.
+
+
+ Example of usage
+ // ContextMenus bit from list of server features
var contextMenusEnabled = GetServerFeature( 0x08 );
-
-
-
+
Prototype
-string GetServerSetting( serverSettingString );
-Purpose
-Fetches the value of a specified server setting and returns it as a string. Wrap in parseInt() if expected value returned is an int.
-Example of usage
-// Returns 1 if GUARDSACTIVE is set to 1 in UOX.INI, or 0 if set to 0.
+
+
+
+
+
+ Prototype
+ string GetServerSetting( serverSettingString );
+
+
+ Purpose
+ Fetches the value of a specified server setting and returns it as a string. Wrap in parseInt() if expected value returned is an int.
+
+
+ Example of usage
+ // Returns 1 if GUARDSACTIVE is set to 1 in UOX.INI, or 0 if set to 0.
var guardsActive = GetServerSetting( "GUARDSACTIVE" );
-
-
-
+
Prototype
-SOCKET GetSocketFromIndex( socketIndex );
-Purpose
-Create a socket-object based on the specified socketIndex
-Example of usage
-// Fetch whichever socket is connected to the server as socket/connection 0
+
+
+
+
+
+ Prototype
+ SOCKET GetSocketFromIndex( socketIndex );
+
+
+ Purpose
+ Create a socket-object based on the specified socketIndex
+
+
+ Example of usage
+ // Fetch whichever socket is connected to the server as socket/connection 0
var socket = GetSocketFromIndex( 0 );
-
-
-
+
Prototype
-bool IsInBuilding( x, y, z, world, instance, checkHeight );
-Purpose
-Returns true if specified location is inside a static building (underneath static items), or if player is inside a multi.
-Notes
-If checkHeight argument is true, player is only deemed inside a multi if there are multi-items above the player's head. If player is in a courtyard/on a rooftop, they will be deemed to be NOT in the building. checkHeight is not used for the static part of the function, only for multis.
-Example of usage
-var isCharInBuilding = IsInBuilding( myChar.x, myChar.y, myChar.z, myChar.worldnumber, myChar.instanceID, true );
- Prototype
+bool IsInBuilding( x, y, z, world, instance, checkHeight );
+Purpose
+Returns true if specified location is inside a static building (underneath static items), or if player is inside a multi.
+Notes
+If checkHeight argument is true, player is only deemed inside a multi if there are multi-items above the player's head. If player is in a courtyard/on a rooftop, they will be deemed to be NOT in the building. checkHeight is not used for the static part of the function, only for multis.
+Example of usage
+var isCharInBuilding = IsInBuilding( myChar.x, myChar.y, myChar.z, myChar.worldnumber, myChar.instanceID, true );
+ Prototype
-int IterateOver( objectType );
-Purpose
-Iterates over all objects of specified type in the world.
-Notes
-For every object it comes across, the iterator will call a function onIterate( object ) in the same script. Supported object types: "BASEOBJ", "CHARACTER", "ITEM", "SPAWNER", "MULTI", "BOAT"
-Example of usage
-var itemCount = IterateOver( "ITEM" );
+
+
+
+
+
+ Prototype
+ int IterateOver( objectType );
+
+
+ Purpose
+ Iterates over all objects of specified type in the world.
+
+
+ Notes
+ For every object it comes across, the iterator will call a function onIterate( object ) in the same script. Supported object types: "BASEOBJ", "CHARACTER", "ITEM", "SPAWNER", "MULTI", "BOAT"
+
+
+ Example of usage
+ var itemCount = IterateOver( "ITEM" );
Console.log( itemCount + " items found!" );
...
function onIterate( myObject )
@@ -6701,111 +6736,113 @@ January 9th, 2022
// ... optionally do something here
return true;
}
-
-
-
+
Prototype
-int Moon( moonNum );
-void 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 );
+
+
+
+
+
+ Prototype
+ int Moon( moonNum );
+ void 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
-
-
-
+
Prototype
-int RandomNumber( loNum, hiNum );
-Purpose
-Returns a random number between loNum (inclusive) and hiNum (inclusive)
-Example of usage
-var iNum = RandomNumber( 0, 10 );
- Prototype
+int RandomNumber( loNum, hiNum );
+Purpose
+Returns a random number between loNum (inclusive) and hiNum (inclusive)
+Example of usage
+var iNum = RandomNumber( 0, 10 );
+ Prototype
-void Reload( subSystemID );
-Purpose
-Dynamically reloads one (or all) of UOX3's subsystems without having to restart UOX3
-Notes
-Supported subSystemIDs: -
Example of usage
-// Reload all DFNs (and Skill system)
+
+
+
+
+
+ Prototype
+ void Reload( subSystemID );
+
+
+ Purpose
+ Dynamically reloads one (or all) of UOX3's subsystems without having to restart UOX3
+
+
+ Notes
+
+ Supported subSystemIDs:
+
+ - 0 - Regions/TeleportLocations
+ - 1 - Spawn Regions
+ - 2 - Spells
+ - 3 - Commands
+ - 4 - DFNs/Skills
+ - 5 - JScripts
+ - 6 - HTML Templates
+ - 7 - INI
+ - 8 - Everything
+ - 9 - Accounts
+ - 10 - Dictionaries
+
+
+
+
+ Example of usage
+ // Reload all DFNs (and Skill system)
Reload( 4 );
// Reload INI file
Reload( 7 );
-
-
-
+
Prototype
-void ReloadJSFile( scriptID );
-Purpose
-Dynamically reloads script with specified scriptID from jse_fileassociations.scp without having to restart UOX3
-Notes
-Cannot be used to validate sockets
-Example of usage
-// Example of how this is used by 'reloadjsfile command
+
+
+
+
+
+ Prototype
+ void ReloadJSFile( scriptID );
+
+
+ Purpose
+ Dynamically reloads script with specified scriptID from jse_fileassociations.scp without having to restart UOX3
+
+
+ Notes
+ Cannot be used to validate sockets
+
+
+ Example of usage
+ // Example of how this is used by 'reloadjsfile command
function CommandRegistration()
{
RegisterCommand( "reloadjsfile", 3, true ); //Reload JavaScript file
@@ -6818,70 +6855,70 @@ January 9th, 2022
ReloadJSFile( scriptID );
}
-
-
-
+
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
-// Roll a DnD style dice of type 2d3+1 (2 dice with 3 faces, add 1 to result)
+
+
+
+
+
+ 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
+ // Roll a DnD style dice of type 2d3+1 (2 dice with 3 faces, add 1 to result)
var mDie = RollDice( 2, 3, 1 );
-
-
-
+
Prototype
-bool/int/string/object TriggerEvent( scriptID, "functionName", argument1, argument2 );
-Purpose
-Calls script with specified scriptID, runs function in said script that matches "functionName", with the defined function arguments. The called upon script can return a value in the form of a boolean, int, string or an object
-Example of usage
-// Calls script with ID 8000 and runs function "onUseChecked" with function parameters pUser and iUsed
+
+
+
+
+
+ Prototype
+ bool/int/string/object TriggerEvent( scriptID, "functionName", argument1, argument2 );
+
+
+ Purpose
+ Calls script with specified scriptID, runs function in said script that matches "functionName", with the defined function arguments. The called upon script can return a value in the form of a boolean, int, string or an object
+
+
+ Example of usage
+ // Calls script with ID 8000 and runs function "onUseChecked" with function parameters pUser and iUsed
var returnVal = TriggerEvent( 8000, "onUseChecked", pUser, iUsed );
-
-
-
+
Prototype
-TriggerTrap( pChar/pSock, iTrap );
-Purpose
-pChar/pSock triggers trap on iTrap object (if any trap is present on object)
-Notes
-Trap will only trigger if both first two parts of MOREZ value is set on object; first part needs to be set to 1 to indicate object is trapped, second part needs to specify damage amount to apply.
-Example of usage
-// Setup trap on iTrap object
+
+
+
+
+
+ Prototype
+ TriggerTrap( pChar/pSock, iTrap );
+
+
+ Purpose
+ pChar/pSock triggers trap on iTrap object (if any trap is present on object)
+
+
+ Notes
+ Trap will only trigger if both first two parts of MOREZ value is set on object; first part needs to be set to 1 to indicate object is trapped, second part needs to specify damage amount to apply.
+
+
+ Example of usage
+ // Setup trap on iTrap object
// First part of value (01) indicates object is trapped
// Second part of value (32) defines damage dealt (32 = 0x32 = 50 damage)
// Third (00) and Fourth (00) parts, unused here, normally indicate the min/max skill required to disarm trap
@@ -6890,148 +6927,148 @@ January 9th, 2022
// Trigger the trap
TriggerTrap( pChar, iTrap );
-
-
-
+
Prototype
-void UseItem( pSock/mChar, iToUse );
-Purpose
-To allow characters (and NPCs in particular) to trigger item-use functionality of items
-Notes
-Either a socket or a character can be passed in as a parameter of the UseItem function. If a socket is passed in, UOX3 will derive the character using the item from said socket.
-Example of usage
-// If an item has type 12, make NPC use the door to open it
+
+
+
+
+
+ Prototype
+ void UseItem( pSock/mChar, iToUse );
+
+
+ Purpose
+ To allow characters (and NPCs in particular) to trigger item-use functionality of items
+
+
+ Notes
+ Either a socket or a character can be passed in as a parameter of the UseItem function. If a socket is passed in, UOX3 will derive the character using the item from said socket.
+
+
+ Example of usage
+ // If an item has type 12, make NPC use the door to open it
if( myItem.type == 12 )
{
mChar.TextMessage( "A door! What's on the other side?" );
UseItem( mChar, iToUse );
}
-
-
-
+
Prototype
-bool ValidateObject( object );
-Purpose
-Returns true if argument is a valid object (Item, Character, Multi, Boat, Spawner)
-Notes
-Cannot be used to validate sockets
-Example of usage
-if( !ValidateObject( iUsed ))
+
+
+
+
+
+ Prototype
+ bool ValidateObject( object );
+
+
+ Purpose
+ Returns true if argument is a valid object (Item, Character, Multi, Boat, Spawner)
+
+
+ Notes
+ Cannot be used to validate sockets
+
+
+ Example of usage
+ if( !ValidateObject( iUsed ))
return;
-
-
-
+
Prototype
-[int] WorldBrightLevel( [lightlevel] );
-Purpose
-Get/Set the "maximum brightness" light-level for daytime across the entire world
-Notes
-If no parameter is provided, function will return current "maximum brightness" light-level for daytime instead.
-Example of usage
-// Set maximum world brightness level to 1
+
+
+
+
+
+ Prototype
+ [int] WorldBrightLevel( [lightlevel] );
+
+
+ Purpose
+ Get/Set the "maximum brightness" light-level for daytime across the entire world
+
+
+ Notes
+ If no parameter is provided, function will return current "maximum brightness" light-level for daytime instead.
+
+
+ Example of usage
+ // Set maximum world brightness level to 1
WorldBrightLevel( 1 );
// Get current maximum world brightness level
var lightLevel = WorldBrightLevel();
-
-
-
+
Prototype
-[int] WorldDarkLevel( [lightlevel] );
-Purpose
-Get/Set the "minimum brightness" light-level for night-time across the entire world
-Notes
-If no parameter is provided, function will return current "minimum brightness" light-level for night-time instead.
-Example of usage
-// Set minimum world brightness level to 15
+
+
+
+
+
+ Prototype
+ [int] WorldDarkLevel( [lightlevel] );
+
+
+ Purpose
+ Get/Set the "minimum brightness" light-level for night-time across the entire world
+
+
+ Notes
+ If no parameter is provided, function will return current "minimum brightness" light-level for night-time instead.
+
+
+ Example of usage
+ // Set minimum world brightness level to 15
WorldDarkLevel( 15 );
// Get current maximum world brightness level
var lightLevel = WorldDarkLevel();
-
-
-
+
Prototype
-[int] WorldDungeonLevel( [lightlevel] );
-Purpose
-Get/Set the fixed light-level for any regions marked as dungeons
-Notes
-If no parameter is provided, function will return current fixed light-level for dungeons instead.
-Example of usage
-// Set fixed dungeon light level to 12
+
+
+
+
+
+ Prototype
+ [int] WorldDungeonLevel( [lightlevel] );
+
+
+ Purpose
+ Get/Set the fixed light-level for any regions marked as dungeons
+
+
+ Notes
+ If no parameter is provided, function will return current fixed light-level for dungeons instead.
+
+
+ Example of usage
+ // Set fixed dungeon light level to 12
WorldDungeonLevel( 12 );
// Get current fixed light level of dungeons
var lightLevel = WorldDungeonLevel();
-
-
-
+