Terminal Formatting Guide

(Alkaline Thunder) #1

In Peacenet’s older Peace Engine builds, the terminal emulator had support for various color and font codes that allow you to convey additional information in your command output - such as making error text appear red, etc. See below!

This feature is also in the upcoming Unreal releases, so, I’m creating this post to show you guys how to use it in both the game’s code and as a player.

This is also a place for me to memorize these codes instead of having to look in the C++ code for the terminal renderer, so, that’s cool.

Inside Blueprint and C++

Right now, there’s no explicit functions that allow you to set the color and font of text in the Terminal. However, in the Write, Write Line and Overwrite Line functions, you can embed the same formatting codes that players can. See below.

As a player

The Terminal can display 16 different foreground colors. There is currently no support for changing background colors, though, this will be added later on. To set the foreground color of a given piece of text, type a backtick (`) then a single hexadecimal digit (case-insensitive).

The available colors are as follows:

`0: Black
`1: White
`2: Gray
`3: Red
`4: Green
`5: Blue
`6: Orange
`7: Yellow
`8: Light Blue
`9: Light Green
`A: Pink
`B: Purple
`C: Light Pink
`D: Dark Red
`E: Dark Blue
`F: Dark Green

You can also change the style of your text. Text can either be regular, bold, italic or ***bold-italic***. Like color codes, simply prefix your text with a backtick and one of the following symbols:

`r: regular
`*: bold
`_: italic
`-: bold-italic

Since the game sees all backticks as the start of a formatting code, it will not render the backtick if it sees a valid formatting code after it. So, trying to type “`regular” in your terminal will result in the game simply rendering the text egular (note the missing r) in the regular font. To get around this, instead of typing just one backtick, type two in a row, i.e “``regular”. This will result in the game rendering a literal backtick, then the word “regular”.