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

Example : sysNumPlayersWithPlayerVarVal( 6, 2 ) returns number of players with $gPlayerVar[6] == 2. Useful for determining results of a team game.

sysGenerateTopPlayerVarsList

Format sysGenerateTopPlayerVarsList( VarNum, Num_players_to_list )
Description Generates a list of players sorted by the $gPlayerVar selcted. e.g. sysGenerateTopPlayerVarsList(2, 5)) will generate a list of the top 5 players with the highest value in $gPlayerVar[2]. Your script can then access the generated list using sysGetTopPlayer
Returns The number of players actually added to the list. (Only players with the PlayerVar above 0 get added)


sysGetTopPlayer

Format sysGetTopPlayer ( List_Index )
Description Access the list of top players generated using sysGenerateTopPlayerVarsList. List_Index starts at 0, so sysGetTopPlayer(0) gets the person at the top of the list, (1) gets the second, etc.
Returns PlayerID

sysGetPlayerListScore

TBD

scripting/reference/system_functions/playerstatusfunctions.1581068238.txt.gz · Last modified: 2020/02/07 03:37 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