Text in Scripts

Text (String)

Skript allows you to write pieces of text (programmers usually call them strings) in the scripts. This is done by putting the text inside double quotes, as follows:

"this is text"

Simple, isn't it? If an effect, expression, condition, trigger or function accepts something of type text or string, you can use this format to write it right there!

Formatting Text

But isn't just text a bit boring? Worry not, as Minecraft has support for colors, styles and other formatting options in chat. Most of the options also work with item and entity names.

Colors

Minecraft has 16 pre-set color codes to be used in text. Skript supports them in two different ways:

Color name tags, for example <red> Minecraft color codes, like §c; using & works, too

Here's a table of all colors, including both Skript names and color codes:

Color Code Name Alternative Names
§0 black
§1 blue dark blue
§2 green dark green
§3 cyan aqua, dark cyan, dark aqua, dark turquoise, dark turquois
§4 red dark red
§5 purple dark purple
§6 orange orange, gold, dark yellow
§7 grey light grey, gray, light gray, silver
§8 dark gray dark grey
§9 light blue light blue, indigo
§a light green lime, lime green
§b light cyan light aqua, turquoise, turquois, light blue
§c light red pink
§d magenta light purple
§e yellow light yellow
§f white

In Minecraft 1.16, support was added for 6-digit hexadecimal colors to specify custom colors other than the 16 default color codes. A new tag can be used to format with these colors. The tag looks like this:

<##hex code>

Here's what the tag would look like when used in a script:

send "<##123456>Hey %player%!" to player

For information not related to Skript, see Minecraft Wiki page concerning colors. Note that depending on Skript configuration, color codes may do more than just change color of text after them. By default, for backwards compatibility, they clear following styles: magic, bold, strikethrough, underlined, italic. Other styles are not affected, and this feature can be toggled of in config.sk.

Other Styles

Minecraft also has various other styles available. The following are available everywhere, including item and entity names:

Code Name Alternative Names
§k magic test obfuscated
§l bold b
§m strikethrough strike, s
§n underlined underline, u
§o italic italics, i
§r reset r

If it wasn't clear from the table, §r clears all other formatting and colors. You'll probably use it quite often when sending chat messages from scripts.

Skript also supports certain newer features, which are only available in chat. Those do not have formatting codes, so you must use tags for them.

                        
Name Alternative Names Description
link open url, url Opens a link when player clicks on text
run command command, cmd Makes player execute a chat command when they click on text
suggest command sgt Adds a command to chat prompt of player when clicked
tooltip show text, ttp Shows a tooltip when player hovers over text with their mouse
fontfChange the font of the text (1.16+)
insertion insert, ins Will append a text at player's current cursor in chat input only while holding SHIFT.

All of these styles require a parameter, in format

<name:parameter>

For link, parameter must be either http or https url if you want clients to recognize it. For others, it can be any text you'd like (you can make player run invalid commands if you wish).

Text and Variables

Variable names are text, but obviously formatting that text does no good. However, everything else you can do for text, you can do for variable names. A guide about this is coming... some day.

Guide written by bensku.