SBARINFO

From ZDoom Wiki
Jump to: navigation, search

SBARINFO allows for custom status bars to be made without the need for ACS. Only the last SBARINFO lump will be read. If there is a need for more than one SBARINFO lump another can be included with the #include funtion. (#include syntax is identical to DECORATE.)

The syntax requires that all image names be in quotes. When something must have no image, for example the "off" sprite in a weapon indicator when you don't have that weapon, you can specify "" for "no image, leave it blank (unless otherwise noted)". The string "nullimage" can also be used for this. Note: an empty image cannot currently be used in place of the "default" argument of DrawMugShot.

Mugshot scripting may be used with the default Doom status bar. Simply do not define any status bars to use.

Where flags are specified the pipe operator ("|") can be used instead of commas.

Top Level Commands

Base <game>

Set the status bar to the specified game. As of right now the resulting status bar can not be modified. Valid games are Doom, Heretic, Hexen, Strife, and None.

CompleteBorder {true|false}

Continues drawing the border where the status bar is normally placed. Using this will remove the HOM.

CreatePopup <name>, <width>, <height>, <transition> [, transition args (see below)]

Sets the transition effect for the specified popup (log, keys, status). Width and Height help the transition determine a starting point. For None this could technically be anything. The transition can be any of the following:

None
Popup will appear instantly when activated. (No additional args)
SlideInBottom
Popup will slide up from the bottom at the specified speed pixels per tic. (Args: <speed>)
PushUp
Identical to SlideInBottom except if the primary status bar does not use fullscreenoffsets, it will be displaced by the popup's movements. (Args: <speed>)
Fade
Popup will fade in to the translucency of the status bar. Both args are floats and represent the amount in time in seconds for the fade to complete. (Args: <fade-in speed>, <fade-out speed>)

Height <height>

Sets the height of the status bar. When set you will be expected to cover all the area between points (0, 200-height) and (320, 200). If the area is not covered a HOM will be drawn instead. Note: If fullscreenoffsets is used, then Height will not perform correctly and will end up too tall in most cases. They should not be used together.

InterpolateHealth {true|false} [, <speed>]

Interpolates the value drawn for health. This is useful for drawing life bars so that the gem will smoothly move between positions like in Heretic and Hexen. Speed is by default set to 8 which is the same as used for Heretic (Hexen used 6). Speed is measured in hp per tic.

InterpolateArmor {true|false} [, <speed>]

Similar to InterpolateHealth, interpolates the value drawn for armor. Speed is set to 8 by default.

LowerHealthCap {true|false}

Sets whether health should go no lower than 0. Default is true.

MonospaceFonts {true|false}, <character>[, <alignment>]

Monospaces all fonts to the specified character of their font. Alignment (New from 2.5.0) changes the position of off size characters within their spacing. Valid arguments are left (default), center, or right.

Resolution <x>, <y>

Sets the base resolution for the status bar. By default this is 320x200. (New from 2.5.0)

StatusBar <stbar> [, <flags>...] [, <alpha>]

Begins the drawing routine for the specified status bar. Valid status bars are:

None
Draws where there is supposed to be no statusbar. Should be used sparingly.
Fullscreen
ZDoom's fullscreen hud.
Normal
Standard status bar.
Automap
Used for Hexen-style auto map status bars.
Inventory
Inventory bar drawn over the Normal status bar.
InventoryFullscreen
Inventory bar drawn over the fullscreen hud.
PopupLog
Strife-style popup for the log.
PopupKeys
Strife-style popup for keys.
PopupStatus
Strife-style popup for the statistics.
Flags are as follows:
FullScreenOffset reference sheet
forcescaled
Forces the status bar to be scaled even if the user has scaling off. This flag is ignored on the Inventory and InventoryFullscreen bars.
fullscreenoffsets
Changes the coordinate system to be relative to a corner of the screen. Using positive or negative values will change which side of the screen the offset is from: a positive x value is from the left, a negative one is from the right; a positive y value is from the top, and a negative one from the bottom. For example, a y coordinate of 32 will position the bar 32 pixels from the top of the screen, while a y coordinate of -32 will position it 32 pixels from the bottom.

Alpha is a value from 0.0 to 1.0 with 0.0 being invisible and 1.0 being opaque.

For any coordinate on a bar using fullscreenoffsets, you may add "center" to the coordinate to center it along that axis. For example "-16 + center" on an X coordinate would mean 16 pixels left of center. Due to current limitations "+ center" must come after the integer value.

Note: Using fullscreenoffsets breaks the Height parameter and makes it seem too tall in most cases. Because of this, it is not recommended to use fullscreenoffsets on "Normal" status bars.

Alpha <amount>

Increases the translucency for the following sub block. (New from 2.5.0)

AspectRatio {"4:3" | "5:4" | "16:9" | "16:10"}

Executes the following sub block only if the player is using the specified aspect ratio.

DrawBar <fgimage>, <bgimage>, <number>, {horizontal|vertical}, [flags, ..., ] <x>, <y> [, <border>]

Error.gif
Warning: The border property is here so that the bar graphics from Hexen can be used as-is. Using this property may cause numerous undesired side effects due the fact that it renders the foreground before the background. If you are using a background image there is no reason you should ever have to use this property

Draws a bar using a truncated form of fgimage over bgimage (or black if nullimage is used). Fgimage and bgimage must be the same size. Number can be any of the values from DrawNumber with the exception of AmmoCapacity, Monsters, TotalItems, and TotalSecrets. If health or armor is used you can optionally specify an inventory item to represent the max amount the player can hold. If border is supplied then the specified amount of pixels on each side from the foreground will always be drawn. Flags are as follows:

reverse
Reverses the direction of the bar (see below for defaults).
interpolate(<speed>)
Interpolates the value drawn. (New from 2.5.0)

If the bar is horizontal it will default to left to right. For vertical it defaults to bottom to top as in Hexen.

DrawGem [flags, ..., ] <chainimage>, <gemimage>, <leftpadding>, <rightpadding>, <chainsize>, <x>, <y>

Draws a Heretic style life gem. The gem can move anywhere on the chainimage unless paddings are specified. The chain will shift a maximum of chainsize pixels to the right while the gem is moving. Flags are:

wiggle
Enable Heretic style wiggling.
translatable
Add player color translations to the gem image.
armor
Changes the value represented from health to armor.
reverse
Reverses the direction of the gem.
interpolate(<speed>)
Interpolates the value drawn. (New from 2.5.0)

DrawKeyBar <size>, {vertical|horizontal}, [flags, ..., ] <icon-size>, <x>, <y> [, <keyoffset> [, <rowsize>, <rowicon-size>]]

Draws the inventory icon of all the keys the player is holding (up to the specified size). The icons will be placed icon-size pixels apart. On a vertical bar the keys start at the top and move to the bottom. On a horizontal they go left to right.

Icon sizes may be auto to have the bar space the icons automatically. Key offset will offset which keys are drawn. For example if the player has 6 keys and the first keybar hold 3 keys it will show key 1-3. If the second bar has an offset of 3, then it will show keys 4-6. Rowsize is how many keys should be displayed in a row/column. Rows/columns go left to right on vertical bars and top to bottom on horizontal bars. Rowicon-size specifies the spacing between rows/column.

Valid flags are:

reverserows
Changes the rows to go right to left on vertical bars and bottom to top on horizontal bars.
reverse
Changes the order in which rows are filled. (New from 2.5.0)

DrawInventoryBar <style> [, flags, ... ], <size>, <font>, <x>, <y> [, <counterx>, <countery> [, <translation> [, <fontspacing>]]]

Draws a inventory bar at x, y, with size item places. The font is used for the amounts. Flags are:

alwaysshow
Draw the bar even if no items are present.
noartibox
Will not draw atrifact boxes.
noarrows
Will not draw the arrows telling the user there are more items to the left and/or right of the viewable items.
alwaysshowcounter
Will show the amount even if the player is holding 1 of the said item.
translucent
Draws the entire inventory bar with translucency.
vertical
Draws the inventory bar vertically.
drawshadow[(<xOffset>, <yOffset>)
Adds a shadow to the inventory item's amounts. (development version r2928+ only)

Style can be any of the following:

Doom
Standard inventory bar.
Heretic
Same as Doom but SELECTBO is drawn 29 pixels lower.
Hexen
Same as Doom but SELECTBO is drawn 1 pixel higher.
HexenStrict
Shifts the icon 2 pixels to the left, moves SELECTBO 1 pixel up and to the left, and changes the alignment of the arrows. (New from 2.5.0)
Strife
SELECTBO is changed to INVCURS. INVCURS is drawn behind the icons. Each item is given 35 pixel spacing instead of 31 pixels. In addition INVCURS is drawn at (x-6, y-2).

The final optional arguments deal with the font. Counterx and countery is where the numbers should start drawing. If these are not specified, the default is x+26 for counterx and y+22 for countery. See DrawNumber for information on translation and fontspacing.

DrawImage [translatable] <image>, <x>, <y> [, {center|centerbottom}]

Draws "image" to the screen at the specified coordinates, which are absolute coordinates on a scaled screen. By default the coordinates are referenced by the top left corner of the image. Specifying center will change this behavior to be the very center of the image (taking the image offsets into consideration).

If translatable is specified the image will translate itself to the player's color.

In addition to an image lump name a few special values can be used.

playericon
Draws the player.scoreicon for the user's playerclass.
armoricon
Draws an image of the currently in use armor type. If the amount of armor the player has is 0, nothing will be displayed.
weaponicon
Draws the inventory.icon of the currently selected weapon.
ammoicon1
Draws the primary ammo icon.
ammoicon2
Draws the secondary ammo icon.
sigil
Draws the proper icon for the Sigil.
hexenarmor <armor>, <image>
Fades the image based on the availability of the specified Hexen armor (armor, shield, helm, amulet)

DrawMugShot [<default>*,] <accuracy> [, flags, ...], <x>, <y>

Draws a mug shot at the specified location. It will prefix the image to what is specified in default and will automatically adjust itself to skins. Accuracy can be a number 1-9 which specifies how many blood levels there are before death. Flags are:

xdeathface
Will draw ***XDTH0-***XDTH5 when the player is gibed.
animatedgodmode
***GOD1 and ***GOD2 will also be displayed while in god mode.
disablegrin
Disables the grin state.
disableouch
Disables the ouch state.
disablepain
Disables the pain state.
disablerampage
Disables the rampage state.

* This argument is optional as it should no longer be used if possible. Use playerclass faces instead.

DrawNumber <size>, <font>, <color>, <value>, [flags, ...,] <x>, <y> [, <fontspacing>] [, <translation-low>, <low-value> [, <translation-high>, <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 translation is provided then that translation will be used if the value is less than or equal to the specified. If a high translation is provided then that translation will be used when the value is greater than or equal to the specified.

For number, 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. (development version r2924+ only)
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. (development version r2924+ only)
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. (development version r2924+ only)
Secrets
Number of secrets found.
Score
Current player score (see APROP_Score and ScoreItem) (New from 2.5.0)
Stamina
Amount of stamina upgrades received. (development version r2924+ only)
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. (development version r3277+ only)
Ammo2Capacity
The maximum amount of secondary ammo the player can hold for the current weapon. (development version r3277+ only)
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.

Flags are:

alignment({left|center|right})
Changes the alignment of the string. (New from 2.5.0)
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>) (New from 2.5.0)]
Will also draw a translucent number by default two pixels to the right and two pixels down.
interpolate(<speed>)
Interpolates the value drawn. (New from 2.5.0)
dontcap
Draws the lower digits of the number instead of capping. (development version r3165+ only)
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. (development version r3165+ only)

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.

DrawSelectedInventory [flags, ..., ] <font>, <x>, <y> [, <counterx>, <countery> [, <translation> [, <fontspacing>]]]

Draws the selected inventory item at the specified location with the specified font for the amount. See DrawInventorybar for the optional arguments. The default for counterx is x+30 and y+24 for countery. Flags are:

alternateonempty
Executes a sub block if the player is holding no inventory items.
artiflash
Displays a Heretic/Hexen style artifact flash when an item is used.
itemflash
Displays and fades INVCURS when an item is used. (development version r2928+ only)
alwaysshowcounter
Displays the counter even if the the player is only holding 1 of the item.
drawshadow[(<xOffset>, <yOffset>) (New from 2.5.0)]
Same as the drawshadow flag for drawnumber. Affects the counter.
center
Sets the alignment of the inventory icon to its center.
centerbottom
Sets the alignment of the inventory icon to the center of its bottom.

If alternateonempty is specified the semicolon must be removed and everything in the sub block will be executed.

DrawShader <width>, <height>, {horizontal|vertical}, [reverse, ] <x>, <y>

Draws a transparency gradient at the specified location. The default is to go from left to right (dark to bright) or bottom to top.

DrawString <font>, <translation>, <string>, <x>, <y> [, <spacing> [, <flags>]]

Draws the string at the specified coordinates. Like drawnumber, the coordinates specify the top right hand corner of the string.

In addition to a string constant, the following are also accepted: (New from 2.5.0)

levelname
Prints the name of the current level.
levellump
Prints the lump name of the current level.
skillname
Prints the name of the current skill level.
playerclass
Prints the display name of the player's class.
playername
Prints the name of the current player.
ammo1tag
Prints the tag of the primary ammo.
ammo2tag
Prints the tag of the secondary ammo.
weapontag
Prints the tag of the current weapon.
inventorytag
Prints the tag of the current inventory item.
globalvar <num>
Prints the string referenced by the global variable.
globalarray <num>
Prints the string referenced by array[playernumber()].
time
Prints the amount of time spent on the level. (development version r2928+ only)
logtext
Prints the current log message. (development version r2928+ only)

Flags are:

alignment({left|center|right})
Changes the alignment of the string. (New from 2.5.0)
drawshadow[(<xOffset>, <yOffset>)]
Will also draw a translucent string. (development version r2656+ only)
linebreaks(<size>)
Will split the text up into multiple lines if it exceeds the specified size. Note that this does not take into account font spacings. (development version r2928+ only)

DrawSwitchableImage weaponslot <#>, <image-off>, <image-on>, <x>, <y> [, {center|centerbottom}]

DrawSwitchableImage invulnerable, <image-on>, <image-off>, <x>, <y> [, {center|centerbottom}]

DrawSwitchableImage keyslot <#> [&& <#>, <image0>, <image1>], <image2>, <image3>, <x>, <y> [, {center|centerbottom}]

DrawSwitchableImage armortype <armor1> && <armor2>, <image0>, <image1>, <image2>, <image3>, <x>, <y> [, {center|centerbottom}] (New from 2.5.0)

Special cases of DrawSwitchableImage. See below.

DrawSwitchableImage <inventory-item> [&& <inventory-item>, <image0>, <image1>], <image2>, <image3>, <x>, <y> [, {center|centerbottom}]

Draws a particular image if the player has a particular item. The item may be any sub-class of Inventory. If a 2nd item is specified, an additional two images are required. If the player is carrying the item then image3 is drawn, else image 2 is drawn. If two items are specified, than image0 is drawn if the player is holding none of the items, image1 if the player is holding item1, image2 if the player is holding just the 2nd, and image3 if the player is holding both.

Comparison operators can be used to check for a specific value of an item or armor. (New from 2.5.0)

Else

Executes the following sub-block if the previous was not executed. (New from 2.5.0)

GameMode <gamemode> [, ...]

Executes the following sub block only if the user is playing one of the specified game modes. Valid game modes are singleplayer, cooperative, deathmatch, and teamgame.

HasWeaponPiece <weapon>, <piecenum>

Executes the following sub block if the player is holding the specified piece for the specified weapon.

InInventory [not] <item1> [, amount] [{&& | ||} <item2>] [, amount]

Executes the following sub block if the specified items are (not) in the players inventory. You can optionally specify a 2nd item with a comparison operator. "Not" inverts the result. Amount is can be used to determine if there is at least that much of the item(s) in the player's inventory. This is useful for checking things like ammo which remain in inventory even if there is 0 of them.

For active powerups you can use their internal name to check if they are currently active.

InventoryBarNotVisible

Executes the following sub block if the player does not have the inventory bar active.

IsSelected [not] <weapon1> [, <weapon2>]

Executes the following sub block only if the player is (not) using one of the two specified weapons.

PlayerClass <classname> [, <classname2> [, <classname3>]]

Executes the following sub block only if the player is one of the specified classes (represented by their display name).

PlayerType <classname> [, <classname2> [, <classname3>]]

Executes the following sub block only if the player is one of the specified classes (represented by their actor class name). Unlike 'PlayerClass' this command is capable of handling inheritance so it also gets executed if the current player class is a subclass of one of the passed class names.

UsesAmmo [not]

Checks if the current weapon uses an ammo type (either primary or secondary). If so it will execute the sub block. Adding "not" will invert the result.

UsesSecondaryAmmo [not]

Checks if the current weapon has a secondary ammo type. If so it will execute the sub block. Adding "not" will invert the result.

WeaponAmmo [not] <ammo1> [{&& | ||} <ammo2>]

Executes the sub block only if the weapon uses the specified ammo (be it primary or secondary). If ammo2 is specified then the result will depend on the operator. If "&&" is used then both ammo types must match one or the other. If "||" is used then only one ammo type must match. If the weapon does not use any ammo then it will always evaluate to true. The "not" inverses the result.

Mug Shots

The mug shot can be scripted with a series of states. A list of states with a special purpose is given below:

Normal
The default face when starting.
Pain
When the player has been damaged.
Ouch
Shown instead of pain when the player loses more than 20 hit points at once.
Rampage
Shown when the player holds down one of the fire buttons.
Grin
Weapon pickup face.
Death
Normal death.
XDeath
Extreme death, this state must be enabled by a drawmugshot flag.
God
Standard Invulnerability.
GodAnimated
Invulnerability when "animatedgodmode" is set.

In addition you can also create pain, ouch, death, and xdeath states for any custom damage types that may be in use. The syntax for that is "State.DamageType".

mugshot "StateName"[, flags, ...]
{
	frame duration;
	// OR
	{frame1[, ...]} duration;
}

Each frame may be 5 letters long (proper prefix will be added later) and may have a duration of -1 (infinite) or any positive number (except for 0). In addition you can list frame names in braces to have SBarInfo pick a random graphic from those named. Every frame must end in a semi-colon.

Now there are some flags (listed after the state name) that you can use to change how SBarInfo reads the frames. They are as follows:

health
Makes the last character of every frame represent the health level. It works by adding the level to the character specified in the definition so you may use any style you want as long as the characters are consecutive (ST0A, ST0B, ST0C, etc would be fine as long as you specify ST0A in SBARINFO).
health2
Same as health except it applies the effect to the second character from the end.
healthspecial
Applies health to the middle frame and health2 to all other frames.
directional
Changes the meaning of frames in braces. Instead of picking a random frame it will pick one of three frames like so: {left, middle, right}. This is only useful for the pain or ouch states which calculate the direction of damage. Otherwise only the middle will be shown.

SBARINFO does support custom states of any name which can be called by the ACS function SetMugShotState.

Examples

An example of mug shot definitions:

mugshot "Normal", health2
{
	{ST00, ST01, ST02} 17;
}

Finally, an example of using the 'fullscreenoffsets' statusbar flag:

Statusbar FullScreen, FullScreenOffsets
{
	//Bottom Left
	//Lives from Inventory with Icon
	DrawImage "LIFEA0", 14, -1;
	DrawNumber 1, CONFONT, WHITE, Life, 35, -10;

	//Top Right
	//Keys
	DrawKeyBar 2, vertical, 13, -8, 0;

	//Bottom Right
	//Points Variable from Global Array 0, index PlayerNumber()
	DrawNumber 8, CONFONT, WHITE, GlobalArray 0 , -2, -25;

	//Ammo and Icon
	DrawImage AmmoIcon1, -105, -1;
	DrawNumber 2, CONFONT, WHITE, Ammo1, -80, -10;

	//Health and Icon
	DrawImage "HLTHE0", -50, -1;
	DrawNumber 3, CONFONT, WHITE, Health, -2, -10;
}

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox