User Tools

Site Tools


scripting:reference:system_functions:playerstatusfunctions

This is an old revision of the document!


Player Information Functions

Most of the information about the player who has triggered the script event is available through System Values - e.g $gPlayerID, $gPlayerCash, $gPlayerX & $gPlayerY.

These system functions can provide information about other players or query extra information about the context player, such as whether they have a particular skill or if they're in a specific town..

sysGetPlayerID

Format sysGetPlayerID( Player Name )
Description Returns the ID for a specified player name
Returns Player ID

Example:

Event( "Custom", "Special" )
{
    $playerID = sysGetPlayerID( "Bob" )
    if ( $playerID <= 0 )
    {
        *msg %PLAYER% Bob doesn't exist on this world
    }
    else
    {
        *msg %PLAYER% Bob's player ID is $playerID
    }
}

sysIsPlayerIDOnline

Format sysIsPlayerIDOnline( Player ID )
Description Used to determine if the specified player is currently online on the world
Returns 1 if the player is connected, 0 if not
Example $isOnline = sysIsPlayerIDOnline(32)

sysIsInSpawnZone

FIXME: This function name is inconsistent, as it only acts on the context player it needs to be renamed to 'sysPlayerIsInSpawnZone'

Format sysIsInSpawnZone( SpawnZone_Type/ID )
Description Used to determine if the current player is within the specified spawn zone region
Returns 1 if the player is in the region, 0 if not
Example $isInDefaultSpawnZone = sysIsInSpawnZone(0)

sysPlayerIsInTown

Example : $var = sysPlayerIsInTown(“Home Town”))
Returns 1 if the current player is within the boundaries of the specified town, 0 if not

sysNumPlayersOnTeam

Example : $var = sysNumPlayersOnTeam(3)
Returns the number of players currently online and in the specified team

sysPlayerSkillLevel

Example : $var = sysPlayerSkillLevel(“Farmer”)
Returns the current player's skill level for the skill named (0 means the player does not yet have this skill)

sysPlayerIsLearningSkill

Example : $isLearning = sysPlayerIsLearningSkill(“Farmer”)
Returns 1 if the player is currently learning the specified skill, 0 if not.

sysNumPlayersWithPlayerVarVal

e.g. sysNumPlayersWithPlayerVarVal( 6, 2 ) returns number of players with $gPlayerVar[6] == 2

sysGenerateTopPlayerVarsList

TBD

sysGetTopPlayer

TBD

sysGetPlayerListScore

TBD

scripting/reference/system_functions/playerstatusfunctions.1581067778.txt.gz · Last modified: 2020/02/07 03:29 by mit

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki