Difference between revisions of "Modding:Statistics"

From DoomRL Wiki

Jump to: navigation, search
m (a few more entries)
(added real_time_ms, drltable edits)
 
Line 2: Line 2:
  
 
== Properties ==
 
== Properties ==
Statistics properties can be called using the syntax "''statistics.stat_name''", where stat_name refers to the property names as explained here. ''(Specific to 0.9.9.6: All statistics from the core game can be updated simply by calling them, but they are also updated by default: default updates are mentioned in the statistic's description.)''
+
Statistics properties can be called using the syntax "''statistics.stat_name''", where stat_name refers to the property names as explained here. All statistics from the core game can be updated simply by calling them, but they are also updated by default: default updates are mentioned in the statistic's description.
  
 
In addition, you can create new statistics using the same syntax and assign them values (e.g., "''statictics.stat_name = 0''"). Values assigned to a statistic must always be an integer.
 
In addition, you can create new statistics using the same syntax and assign them values (e.g., "''statictics.stat_name = 0''"). Values assigned to a statistic must always be an integer.
  
{|class="wikitable" style="border: 2px solid darkred; border-spacing: 0; font-size: 90%; margin: 0.25em 0.5em;"
+
{{drltable|Statistics|2|{{Table2Col
! colspan="2" style="background: darkred; color: yellow; font-size: 120%; text-align: center"|'''Statistics Properties'''
+
{{Table2Col
+
 
   |es=background: #333;
 
   |es=background: #333;
 
   |c1=font-weight:bold; text-align:right; vertical-align:top; padding:0px 2px;
 
   |c1=font-weight:bold; text-align:right; vertical-align:top; padding:0px 2px;
Line 25: Line 23:
 
   |max_kills|The total number of enemies that have appeared since the game started. It is updated upon entering a new level.
 
   |max_kills|The total number of enemies that have appeared since the game started. It is updated upon entering a new level.
 
   |real_time|The amount of real time (that is, measured by a clock) that has passed since the game started. It is updated whenever a game ends.
 
   |real_time|The amount of real time (that is, measured by a clock) that has passed since the game started. It is updated whenever a game ends.
 +
  |real_time_ms|The number of milliseconds that have passed since the game started. It is updated whenever a game ends.
 
   |uniques_found|The total number of [[Specials|uniques]] found over the course of a game. It is updated whenever the player picks up a unique item.
 
   |uniques_found|The total number of [[Specials|uniques]] found over the course of a game. It is updated whenever the player picks up a unique item.
 
   |}}
 
   |}}
|}
+
}}
  
 
== API ==
 
== API ==
{|class="wikitable" style="border: 2px solid darkred; border-spacing: 0; font-size: 90%; margin: 0.25em 0.5em;"
+
{{drltable|Statistics Interface|2|{{Table2Col
! colspan="2" style="background: darkred; color: yellow; font-size: 120%; text-align: center"|'''Statistics Interface'''
+
{{Table2Col
+
 
   |es=background: #333;
 
   |es=background: #333;
 
   |c1=font-weight:bold; text-align:right; vertical-align:top; padding:0px 2px;
 
   |c1=font-weight:bold; text-align:right; vertical-align:top; padding:0px 2px;
Line 38: Line 35:
 
   |'''void'''|statistics.[[#statistics_inc|inc]]('''string''' name, '''integer''' value)  
 
   |'''void'''|statistics.[[#statistics_inc|inc]]('''string''' name, '''integer''' value)  
 
   |}}
 
   |}}
|}
+
}}
  
 
{{Anchor|statistics_inc}}
 
{{Anchor|statistics_inc}}
 
;statistics.inc('''string''' name, '''integer''' value)
 
;statistics.inc('''string''' name, '''integer''' value)
 
:This increments the statistic ''name'' by ''value''. ''value'' can be positive (increasing the statistic) or negative (decreasing the statistic).
 
:This increments the statistic ''name'' by ''value''. ''value'' can be positive (increasing the statistic) or negative (decreasing the statistic).

Latest revision as of 22:12, 24 March 2012

Statistics are not game objects but, rather, a table of values that are accrued throughout the game. Often they are referenced for the purpose of granting medals and badges, although they can be accessed at any time.

Properties

Statistics properties can be called using the syntax "statistics.stat_name", where stat_name refers to the property names as explained here. All statistics from the core game can be updated simply by calling them, but they are also updated by default: default updates are mentioned in the statistic's description.

In addition, you can create new statistics using the same syntax and assign them values (e.g., "statictics.stat_name = 0"). Values assigned to a statistic must always be an integer.

Statistics
bonus_levels_count The total number of special levels that have appeared in the game. It is updated immediately after the game creates the core game episode.
bonus_levels_visited The total number of special levels that the player entered. It is updated whenever the player enters a special level.
bonus_levels_completed The total number of special levels that the player has completed. It is updated whenever the IsCompleted hook for a level is called, or whenever the number of enemies on that level is equal to zero.
damage_on_level The total amount of damage the player has taken on the current level. It is updated whenever the player takes damage, and resets whenever the player exits a level.
damage_taken The total amount of damage that the player has taken over the course of a game. It is updated whenever the player takes damage.
entry_time The amount of game time (that is, measured by in-game turns) that has passed since the game started. It is updated whenever the player enters a level.
game_time The amount of game time that has passed since the game started. It is updated whenever a game ends.
kills The number of enemies that have been killed since the game started. It is updated whenever the player exits a level.
kills_non_damage The number of enemies that have died while the player has not taken damage. It is tracked (but not necessarily updated) each time an enemy dies.
levels_nuked The number of levels that have been successfully nuked. It is updated whenever a nuke explodes, or whenever a player leaves a level that had an active nuke on it.
levers_pulled The number of levers pulled over the course of a game. It is updated whenever a lever is pulled.
max_kills The total number of enemies that have appeared since the game started. It is updated upon entering a new level.
real_time The amount of real time (that is, measured by a clock) that has passed since the game started. It is updated whenever a game ends.
real_time_ms The number of milliseconds that have passed since the game started. It is updated whenever a game ends.
uniques_found The total number of uniques found over the course of a game. It is updated whenever the player picks up a unique item.

API

Statistics Interface
void statistics.inc(string name, integer value)

statistics.inc(string name, integer value)
This increments the statistic name by value. value can be positive (increasing the statistic) or negative (decreasing the statistic).
Personal tools