Difference between revisions of "Modding:Statistics"

From DoomRL Wiki

Jump to: navigation, search
(statistic API)

Revision as of 20:45, 15 January 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. (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.)

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 Properties
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.
game_time The amount of game time (that is, measured by in-game turns) 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.
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.
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