Modding:Statistics
From DoomRL Wiki
Revision as of 21:03, 15 January 2012 by Game Hunter (Talk | contribs)
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 | |
---|---|
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. |
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).