GetLevelInfo

From ZDoom Wiki
Jump to navigation Jump to search

int GetLevelInfo (int levelinfo)

Usage

This function provides you with properties of the current map. If you want to find out the level time, use Timer.

Parameters

  • levelinfo
The level information to get:
  • LEVELINFO_PAR_TIME
Par time of the map.
  • LEVELINFO_SUCK_TIME
Suck time of the map.
  • LEVELINFO_CLUSTERNUM
Number of the cluster to which the map belongs.
  • LEVELINFO_LEVELNUM
Number of the map. (See LevelNum map property)
  • LEVELINFO_TOTAL_SECRETS
Number of total secrets in the map.
  • LEVELINFO_FOUND_SECRETS
Number of revealed secrets.
  • LEVELINFO_TOTAL_ITEMS
Number of total countable items in the map.
  • LEVELINFO_FOUND_ITEMS
Number of picked up countable items.
  • LEVELINFO_TOTAL_MONSTERS
Number of total countable monsters in the map.
  • LEVELINFO_KILLED_MONSTERS
Number of killed monsters.

Return value

Returns value of the specified level property or 0 when the property is unknown.

Examples

This script reports on the player's progress on killing monsters. Similar to the kill count on the automap.

script 2 (void)
{
    int mtotal = GetLevelInfo (LEVELINFO_TOTAL_MONSTERS),
        mkilled = GetLevelInfo (LEVELINFO_KILLED_MONSTERS);

    if (mkilled == mtotal)
    {
        PrintBold (s:"You  have killed all the monsters!");
    }
    else
    {
        PrintBold (s:"You have killed ", d:mkilled, s:" monsters!\n",
            d:mtotal-mkilled, s:" left to go!");
    }
}