User Tools

Site Tools


scripting:system_values_functions_overview

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
scripting:system_values_functions_overview [2012/03/25 18:49] – created mitscripting:system_values_functions_overview [2025/05/28 16:34] (current) – external edit 127.0.0.1
Line 9: Line 9:
 </codedoc> </codedoc>
  
-Here is the full current list of System Values:+For a full list of the system values available, see the [[Scripting:Reference:System  
 +Values|System Values Reference]].
  
-===== Player Stats ===== +===== System Functions =====
-These values give details about the player the current event is executing for.\\ +
-For further details on each value, see the [[Scripting:System Values:Player Stats|Player Stats Reference]]\\ +
-<html> +
-<TABLE align=left WIDTH=90%><TR><TD WIDTH=33% VALIGN=TOP> +
-</html> +
-''gPlayerID \\  +
-gPlayerTeam \\  +
-gPlayerLevel \\  +
-gPlayerKudos \\  +
-gPlayerFamily \\  +
-gPlayerCash \\  +
-gPlayerVehicle \\  +
-gPlayerFuel \\  +
-'' +
-<html> +
-</TD><TD WIDTH=33% VALIGN=TOP> +
-</html> +
-''gPlayerAge \\  +
-gPlayerFollowing \\  +
-gPlayerNumFollowers \\  +
-gPlayerKills \\  +
-gPlayerDeaths \\  +
-gPlayerRobocrowKills \\  +
-gPlayerRobocrowDeaths \\  +
-'' +
-<html> +
-</TD><TD WIDTH=33% VALIGN=TOP> +
-</html> +
-''gPlayerItemCount \\ +
-gPlayerHealth \\  +
-gPlayerHunger \\  +
-gPlayerThirst \\  +
-gPlayerMaxHealth \\  +
-'' +
-<html> +
-</TD></TR></TABLE> +
-</html> +
-\\+
  
-===== Other System Values ===== +System Functions are used to query the state of a particular aspect of your world where parameters are required to obtain the result. System Functions usually start with **sys**.
-<html> +
-<TABLE align=left WIDTH=90%><TR><TD WIDTH=33% VALIGN=TOP> +
-</html> +
-**Player Location**\\ +
-''gPlayerX \\ +
-gPlayerY \\ +
-gNearestBuilding \\ +
-''+
  
-**Tasking interface**\\ +For example, to find out how much of a particular item the current player has :
-''gTaskItem1 \\ +
-gTaskItem2 \\ +
-gTaskItem3 \\ +
-'' +
-<html> +
-</TD><TD WIDTH=33% VALIGN=TOP> +
-</html> +
-**Server Status**\\ +
-''   gServerTime \\      +
-   gNumPlayersOnline\\ +
-''+
  
-**Building access**\\ +<codedoc
-'' gBuildingAccessNum \\ +  $numInInv sysPlayerInventory( "Wood"
-gBuildingScriptParam \\ +  *say %PLAYER% is currently carrying $numInInv Wood 
-'' +</codedoc>
-<html+
-</TD><TD WIDTH=33VALIGN=TOP> +
-</html> +
-**Combat Players**\\ +
-''gKillerID \\ +
-gKilledID \\ +
-gTargetID \\ +
-''+
  
-**Player User-details**\\ +The reference section contains a [[Scripting:Reference:System Functions|full list of System Functions]]. 
-''gPlayerAuth \\ + 
-gPlayerIsMember \\ +===== System Variables ===== 
-'' + 
-<html+Systems Variables are persistent key/value pairs that you can set and retrieve. There are 3 types : 
-</TD></TR></TABLE+  * **Server Variables** ( ''$gServerKey[<KEY_NAME>]'' ) 
-</html>+  * **Building Variables** ( ''$gBuildingKey[<KEY_NAME>]'' ) 
 +  * **Player Variables** ( ''$gPlayerKey[<KEY_NAME>]''
 + 
 +**Server** system variables are global (there are one set of values for your world), each constructed building has its own set of **Building** system variables and each player has their own set of **Player** variables. 
 + 
 +The ''<KEY_NAME>'' is a case-insensitive, unique identifier for each variable and can be whatever you like. System variables can be set to integer values or text strings, and are referenced using the Key Name as shown : 
 +For example: 
 + 
 +<codedoc> 
 +  $gServerKey[Hello] = "Your personalised random number is " 
 +  $gPlayerKey[1] = sysRand( 100 ) 
 +  *say Hi %PLAYER%. $gServerKey[Hello] $gPlayerKey[1]. 
 +</codedoc> 
 +.. this would print ''Hi [Player_Name]. Your personalised random number is [1-100]''
 + 
 +Each script event is run in a particular context which determines the building and player variables the script is currently accessing - i.e. When an 'AccessBuilding' event is triggered, the ''$gBuildingKey''s refer to the values set for the particular building being accessed. In some events (e.g. PlayerLogin, UseItem) Building keys are not applicable. 
 + 
 +For advanced scripting, you can access building and player system variables by changing the event context using ''SetContext'' and ''SetBuildingContext''.
  
scripting/system_values_functions_overview.1332701353.txt.gz · Last modified: (external edit)