String
Syntax¶
Strings can use either single or double quotes and compile directly to DiamondFire String items.
Color Codes (Ampersand Conversion)¶
When ampersands (&
) are immediately proceeded by a character that makes a valid formatting code, they are automatically converted to section symbols (§
) to make that formatting code functional. To prevent ampersands from being converted at all, they can be escaped (see Escape Sequences).
# this message will show up green:
default:SendMessage("&acolored text"); # colored text
# this message will show up white:
default:SendMessage("\&aun-colored text"); # &aun-colored text
# this ampersand doesn't need to be escaped at all:
default:SendMessage("good & evil"); # good & evil
Escape Sequences¶
Quotes, ampersands, and backslashes themselves can all be escaped by immediately proceeding them with a backslash.
default:SendMessage('jeff\'s',"\"amazing\"","creation"); #jeff's "amazing" creation
default:SendMessage(" / iron\&diamonds \\ "); # / iron&diamonds \
Newlines can be inserted using \n
.
Unicode Characters¶
Unicode characters be inserted using the \u
escape code. This is especially useful when working with custom UI elements.
Warning
Unicode escape sequences are evaluated at compile time. Due to this, the following is invalid:
Four Digits¶
Four digit unicode characters can be inserted using \uXXXX
, where each X is a hexadecimal digit.
More or Less Digits¶
Unicode characters with more or less than 4 digits can be inserted using \u{}
, with any number of hexadecimal digits inside the braces.
Operations¶
+ (Addition)¶
str
+ str
: str
¶
Adds the right String onto the end of the left String.
str
+ txt
: txt
¶
Adds the left String onto the beginning of the right Styled Text.
str
+ num
: str
¶
Converts the right Number into a String then adds it onto the end of the right String.
txt
+ str
: txt
¶
Adds the right String onto the end of the left Styled Text.
num
+ str
: str
¶
Converts the left Number into a String then adds it onto the beginning of the left String.
* (Multiplication)¶
str
* num
: str
¶
Repeats the left String right number
times.