Conditional Field on Bricks
This advanced brick option decides whether that brick should run, or should not based on a condition.
The condition to run the brick is that the value must be true (or truthy) If the value is false (or falsy) this brick will not execute.
💡 Here are some additional resources to understand what falsy or truthy mean in the context of JavaScript:
This condition can be any variable or expression or value, as long as they are truthy or falsy they will make it so that the brick will run, or not.
🧙♂️ Pro-tip:
When building mods, it happens often that you want to debug your work. Sometimes there’s a brick that you don’t want to run, but at the same time you don’t want to fully delete it from the mod.
How can you prevent it from being triggered? If you want to “pause” a brick from running without deleting it you can set the Condition to 0
or false
.
Here are some examples of Condition you can set:
Setting these values to the Condition will run the brick:
1
true
“this is a string”
However, setting it to one of the below options will not run the brick:
0
false
{{ false if @input.url }}
You can provide a condition as one of the following:
Text: either a hard-coded value or a text template
Using a text template, the shortest way to write an expression is using their conditional expression syntax: {{ true if *<expr>* }}
.
Learn more in the Text Template Guide
Number: non-zero numbers are considered truthy
Toggle: toggling the brick on/off using a toggle
Variable: a variable from a preceding brick
For complicated business logic, you can use the jq - JSON processor brick, and pass the output to the condition using the variable entry mode.
Last updated