Conditionals and math

Inside a condition you write variable names without braces.

Inline

Quotes are required. To put a conditional inside another, switch to single quotes for the inner one:

If a line holds nothing but conditionals and they all come out empty, the line is dropped.

Multi line

Conditionals in game

Operators

OperatorMeaning
& | !and, or, not
< > <= >=compare numbers
= !=equal, not equal. Text comparison ignores case
hastext contains text, or a list contains an entry
+ - * / % ^math
a ? b ; cb if a is true, else c
??fallback when a value is missing
( )grouping

A value on its own is true when it makes sense to call it true: {{target_block, ...}} is true while you look at a block, {{item:head, ...}} while you wear a helmet.

Item lists match on the display name, so write Totem of Undying and not the id. Effects match on the id. The old changelog also shows all_items.count has 64, but that form does not parse in this build.

Missing values

Some variables have no number at times, like tbx when you look at the sky. Math with a missing value stays missing and prints -. Give it a stand-in with ??.

Printing math

{$ expression} prints the result. {$2, expression} picks the number of decimals.

Calculations, stored values, a macro and a timer

Functions

GroupNames
Roundinground, ceil, floor, abs
Roots and logssqrt, ln, log_e, ln1p, log2, log, log10
Trig, in degreessin, cos, tan, csc, sec, cot, asin, acos, atan, acsc, asec, acot
Constantspi, tau, e, phi

Useful ones