DrawNumber

From ZDoom Wiki
Jump to navigation Jump to search

DrawNumber <size>, <font>, <color>, <value>, [flags, ...,] <x>, <y> [, <fontspacing>] [, <low_color>, <low_value> [, <high_color>, <high_value>]]
Draws a number at the specified location. The first argument specifies the size of the number in digits (Doom's statusbar is set to size 3, for three-digit numbers). The font must be a ZDoom font or defined in FONTDEFS. The font will be translated to color, which can be a color defined in TEXTCOLO. Fontspacing will put the specified amount of pixels between each character (default is 0). If a low_color is provided, then that color will be used if the value is less than or equal to low_value. If a high_color} is provided then that color will be used when the value is greater than or equal to high_value.

For value, you can either supply a constant number, an inventory item, or one of the following:

Health
The player's current health level.
Accuracy
Amount of accuracy upgrades received.
Armor
The amount of armor the player is currently carrying.
ArmorClass
Draws the Hexen armor class of the player.
Ammo1
The amount of primary ammo for the current weapon.
Ammo2
The amount of secondary ammo for the current weapon.
Frags
The number of frags the player has achieved.
Keys
The number of keys picked up.
Kills
The number of monsters that have been killed.
Monsters
The total number of monsters in the map.
Items
Number of items picked up.
TotalItems
Total number of items in the map.
SavePercent
Indicates the percentage of damage absorbed by armor.
Secrets
Number of secrets found.
Score
Current player score (see APROP_Score and ScoreItem)
Stamina
Amount of stamina upgrades received.
TotalSecrets
Total number of secrets in the map.
AirTime
The player's remaining air supply (in seconds) when underwater.
Ammo <AmmoType>
The amount of the specified ammo the player is holding.
AmmoCapacity <AmmoType>
The maximum amount of the specified ammo the player can hold.
Ammo1Capacity
The maximum amount of primary ammo the player can hold for the current weapon.
Ammo2Capacity
The maximum amount of secondary ammo the player can hold for the current weapon.
PowerupTime <PowerupGiver>
Displays the amount of time left for a given powerup.
GlobalVar <num>
Prints the specified global variable in acs.
GlobalArray <num>
Prints the value in a global array with the index of the playernumber.
IntCvar <num>
Prints the cvar specified. Can be a server/user int or bool.

Flags are:

alignment({left|center|right})
Changes the alignment of the string.
fillzeros
Fills the number up to size with zeros. If the number is negative the negative sign will take the first digit's position and the size will be changed accordingly.
whennotzero
Only draws the number if the value is not zero.
drawshadow[(<xOffset>, <yOffset>)]
Draws a translucent shadow effect under the number. If offsets are not given, it defaults to two pixels to the right and two pixels down.
interpolate(<speed>)
Interpolates the value drawn.
dontcap
Draws the lower digits of the number instead of capping.
prefix(value, pad)
Prefixes the number with the specified strings. The value part can be anything that drawstring accepts, but the pad must be a string. When not using a constant for the value part drawstring's caching functionality is disabled.

Also keep in mind that for DrawNumber and DrawString, text will be right-justified, so coordinates specified should be the rightmost portion and not the leftmost like with images.