Skip to content

Conditions

Conditions are used in all of the if blocks rendered conditionally. The value inside of it needs to evaluate to either true or false.

::: @luck is 18 [#block-if (@luck >= 14)] While wandering through the forest, you stumble upon a sparkling rare gem hidden amongst the roots of an old tree. What incredible luck! [/block-if]

While wandering through the forest, you stumble upon a sparkling rare gem hidden amongst the roots of an old tree. What incredible luck!


Nested interpolation is supported.

::: @intelligence is 7, @clue_bonus is 3 [#block-if ({{ @intelligence + @clue_bonus }} >= 9)] You study the intricate mechanism. The clue you found earlier helps you understand its workings. With a satisfying click, you solve the puzzle! [/block-if]

You study the intricate mechanism. The clue you found earlier helps you understand its workings. With a satisfying click, you solve the puzzle!

Logical chaining

While you can nest [#if] blocks inside or [#block-if] to create complex conditions it might be cumbersome of even impossible to implement some functionality.

::: @perception is 15, @courage is 3 You are exploring a dark, ancient ruin. [#block-if (@perception >= 10)] You notice a faint glow emanating from a crack in the wall. It seems to be coming from a hidden chamber. [#if (@courage >= 5)] Without hesitation, you squeeze through the crack to investigate the mysterious light. [#else] Intrigued, but wary of the unknown dangers that may lurk within, you decide to leave the chamber undisturbed for now. [/if] [/block-if]

You are exploring a dark, ancient ruin.

You notice a faint glow emanating from a crack in the wall. It seems to be coming from a hidden chamber.

Intrigued, but wary of the unknown dangers that may lurk within, you decide to leave the chamber undisturbed for now.


Logical operators allow you to create complex conditions.

::: @has_lantern is true, @has_map is true, @knows_path is false You venture into the dark, winding caverns. [#if (@has_lantern && @has_map)] Equipped with a lantern and a map, you confidently navigate the treacherous tunnels. [/if] --- ::: @sanity is -3, @fear is 9 [#block-if (@sanity <= 0 || @fear > 5)] The shadows seem to writhe and whisper around you. You feel a cold dread creeping into your heart, and your mind teeters on the brink of madness. [/block-if]

You venture into the dark, winding caverns.

Equipped with a lantern and a map, you confidently navigate the treacherous tunnels.


The shadows seem to writhe and whisper around you. You feel a cold dread creeping into your heart, and your mind teeters on the brink of madness.

See also