Text¶
Contains enumeration of text formatting codes.
Such codes are used in calls to BWAPI.Game.drawText(), BWAPI.Game.printf(), and print
Important
Although the values are stored as a number type, they are most useful when printed as a character (which Lua does not have a type for; it only has string). The necessary int to char conversion can be done using string.format or string.char like so:
local text = "Your string"
-- using string.format
local formatted1 = string.format("%c%s", BWAPI.Text.White, text)
-- using string.char
local formatted2 = string.char(BWAPI.Text.White) .. text
-- these two techniques will result in exactly the same result
assert(formatted1 == formatted2)
See also
Functions¶
-
static
BWAPI.Text.isColor(c) → bool¶ Checks if the given character is a color-changing control code.
Parameters: c (number) – The BWAPI.Textconstant to checkReturns: trueifcis a regular color (notPrevious,Invisible*, orAlign*)Return type: boolean
Enum¶
-
BWAPI.Text.Previous¶ Value of 1.
Uses the previous color that was specified before the current one.
-
BWAPI.Text.Default¶ Value of 2.
Uses the default blueish color. This color is used in standard game messages.
-
BWAPI.Text.Yellow¶ Value of 3.
A solid yellow.
This yellow is used in notifications and is also the default color when printing text to Broodwar.
-
BWAPI.Text.White¶ Value of 4.
A bright white. This is used for timers.
-
BWAPI.Text.Grey¶ Value of 5.
A dark grey. This color code will override all color formatting that follows.
-
BWAPI.Text.Red¶ Value of 6.
A deep red. This color code is used for error messages.
-
BWAPI.Text.Green¶ Value of 7.
A solid green. This color is used for sent messages and resource counters.
-
BWAPI.Text.BrightRed¶ Value of 8.
A type of red. This color is used to color the name of the red player.
-
BWAPI.Text.Invisible¶ Value of 11.
This code hides all text and formatting that follows.
-
BWAPI.Text.Blue¶ Value of 14.
A deep blue. This color is used to color the name of the blue player.
-
BWAPI.Text.Teal¶ Value of 15.
A teal color. This color is used to color the name of the teal player.
-
BWAPI.Text.Purple¶ Value of 16.
A deep purple. This color is used to color the name of the purple player.
-
BWAPI.Text.Orange¶ Value of 17.
A solid orange. This color is used to color the name of the orange player.
-
BWAPI.Text.Align_Right¶ Value of 18.
An alignment directive that aligns the text to the right side of the screen.
-
BWAPI.Text.Align_Center¶ Value of 19.
An alignment directive that aligns the text to the center of the screen.
-
BWAPI.Text.Invisible2¶ Value of 20.
This code hides all text and formatting that follows.
-
BWAPI.Text.Brown¶ Value of 21.
A dark brown. This color is used to color the name of the brown player.
-
BWAPI.Text.PlayerWhite¶ Value of 22.
A dirty white. This color is used to color the name of the white player.
-
BWAPI.Text.PlayerYellow¶ Value of 23.
A deep yellow. This color is used to color the name of the yellow player.
-
BWAPI.Text.DarkGreen¶ Value of 24.
A dark green. This color is used to color the name of the green player.
-
BWAPI.Text.LightYellow¶ Value of 25.
A bright yellow.
-
BWAPI.Text.Cyan¶ Value of 26.
A cyan color. Similar to Default.
-
BWAPI.Text.Tan¶ Value of 27.
A tan color.
-
BWAPI.Text.GreyBlue¶ Value of 28.
A dark blueish color.
-
BWAPI.Text.GreyGreen¶ Value of 29.
A type of Green.
-
BWAPI.Text.GreyCyan¶ Value of 30.
A different type of Cyan.
-
BWAPI.Text.Turquoise¶ Value of 31.
A bright blue color.
Text.Size¶
Enumeration of available text sizes.
See also
Game.setTextSize()
Enum¶
-
BWAPI.Text.Size.Small¶ Value of 0. The smallest text size in the game.
-
BWAPI.Text.Size.Default¶ Value of 1. The standard text size, used for most things in the game such as chat messages.
-
BWAPI.Text.Size.Large¶ Value of 2. A larger text size. This size is used for the in-game countdown timer seen in
Capture The FlagorUse Map Settingsgame types.
-
BWAPI.Text.Size.Huge¶ Value of 3. The largest text size in the game.