Made the page
 
I believe my previous edit gave necessary info and should not be reverted. I have corrected small grammar mistakes.
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Stats''' are a system of storing integer values. There are three types of stats within Housing: '''Player Stats'''(sometimes referred to as just "stats"), '''Global Stats''', and '''Team Stats'''. Stats do not need to be initialized, and instead default to the value '''0''', only being stored in memory once a stat's value is changed to be non-zero.
'''Stats''' are a mechanic in Housing that allow you to store non-decimal numbers (integers) for extended periods of time. They can be saved to a team or to the house for an indefinite amount of time, or to a player for up to 14 days (365 days with Housing+). Stats are only stored if their value is not equal to 0, as is this their default value.


== Modifying Stats ==
== Interacting with stats ==
All 3 types of stat can be modified with an [[Action|Actions]] that corresponds with each stat type. The "Change Player Stat", "Change Global Stat", and "Change Team Stat" Actions each contain a stat key input, a mathematical "Mode" (operation), and an "Amount" value to serve as the operand. The "Amount" input only accepts integer values and [[Placeholders]]. Additionally, the "Change Team Stat" action contains an additional setting for which [[Team]] the team stat should apply to.  
All types of stats can be modified using their relevant [[actions]], such as Change Player Stat for player stats. These actions follow a template where you are able to define various options. These include the stats key (name), the operation to perform on the key, and the value to use in the operation such as setting the stat to the provided value. The Change Team Stat action also allows a target team to be provided, defaulting to the player's current team.  


Change stat actions currently support five mathematical operations: Increment, Decrement, Set, Multiply, and Divide. The "Amount" value is used as the operand for the supplied mathematical equation, following the function ''x := ƒ(x, y)'' where ''x'' is the supplied stat's value, ''y'' is the "Amount" value, and ''ƒ'' is the operand's function.
There are currently 5 operations, these include incrementation (+), subtraction (-), setting (=), multiplication (×) and division (÷). As mentioned previously, these take the value and use it as an operand alongside the stat's original value. This is with the exception of setting a stat, which is always going to overwrite the current value.  


This can largely be read in plain text as self-explanatory:
== Displaying and referencing stats ==
Stats can be displayed and referenced using [[placeholders]]. These can be used in contexts such as holograms, but also as a value when interacting with stats or conditionals.


> Stat "Kills" ; Mode "Multiply" ; Amount "2"
%stat.player/<key>%
 
%stat.global/<key>%
This "change stat" action will act as the following C/C++ code:
%stat.team/<key> <team name>%
 
> Kills = Kills * 2
or
> Kills *= 2


== Limits ==
== Limits ==
Player stats are limited to 200 keys per player.
By default, there can only be 40 stat keys stored for each type of stat. This limit is applied on a team basis for team stats. For Housing+, this limit is upped to 200. Stats with a value of 0 do not count towards the limit. You can go past the limit on certain types of stats up to a certain point. This is unsupported and may cause immense performance issues as well as stats randomly disappearing or not being loaded properly.
Global stats are limited to 200 keys per House.
Team stats are limited to 200 keys per [[Team]].
 
== Placeholders ==
All stats can be referenced within [[Placeholders]], which allows their values to be parsed into text. This can be used to show stats in chat, titles, or most other text displays. This can also be used to modify a stat by another stat value.
 
The placeholder for player stats is %stat.player/<key>%, or %%stat_<key>%%. The latter is now deprecated.
 
The placeholder for global stats is %stat.global/<key>%, or %%globalstat_<key>%%. The latter is now deprecated.


The placeholder for Team stats is %stat.team/<key> <team name>%.
Player Stats can only be stored for up to 14 days after the player was last seen in your house, or 365 days with Housing+. You can change the default duration for how long a stat is stored for offline players in your houses's [[House Settings|settings]].

Latest revision as of 18:21, 3 September 2024

Stats are a mechanic in Housing that allow you to store non-decimal numbers (integers) for extended periods of time. They can be saved to a team or to the house for an indefinite amount of time, or to a player for up to 14 days (365 days with Housing+). Stats are only stored if their value is not equal to 0, as is this their default value.

Interacting with stats

All types of stats can be modified using their relevant actions, such as Change Player Stat for player stats. These actions follow a template where you are able to define various options. These include the stats key (name), the operation to perform on the key, and the value to use in the operation such as setting the stat to the provided value. The Change Team Stat action also allows a target team to be provided, defaulting to the player's current team.

There are currently 5 operations, these include incrementation (+), subtraction (-), setting (=), multiplication (×) and division (÷). As mentioned previously, these take the value and use it as an operand alongside the stat's original value. This is with the exception of setting a stat, which is always going to overwrite the current value.

Displaying and referencing stats

Stats can be displayed and referenced using placeholders. These can be used in contexts such as holograms, but also as a value when interacting with stats or conditionals.

%stat.player/<key>%
%stat.global/<key>%
%stat.team/<key> <team name>%

Limits

By default, there can only be 40 stat keys stored for each type of stat. This limit is applied on a team basis for team stats. For Housing+, this limit is upped to 200. Stats with a value of 0 do not count towards the limit. You can go past the limit on certain types of stats up to a certain point. This is unsupported and may cause immense performance issues as well as stats randomly disappearing or not being loaded properly.

Player Stats can only be stored for up to 14 days after the player was last seen in your house, or 365 days with Housing+. You can change the default duration for how long a stat is stored for offline players in your houses's settings.