Skip to main content

Complete examples

Pick a rule close to your idea and follow the instructions above each diagram. Open the example in the editor to inspect its fields. In action examples, the test describes what it would do; it does not change a real sheet.

Spend mana only when enough is available

Goal: an ability costs 2 Mana and rolls only if you can pay. On your sheet, this belongs to a button action or a card's On use automation.

Follow these steps

  1. Click Open in the sheet editor. Start at Trigger and follow the lines to If. Click If to see @mana >= 2: the question is “do I have at least 2 Mana?”.
  2. On the Yes path, click Change value. See the target current Mana, the Subtract operation and the Fixed value 2. On your sheet, pick Mana with Pick on the sheet.
  3. Follow the line to Roll dice. The formula 1d20 + @forca rolls a twenty-sided die and adds Strength.
  4. Go back to the No path and click Show message. It warns that there is not enough Mana. This path ends without spending points or rolling.
  5. Open the test result and see the 2 spent before the roll. This example starts with Mana 3. On your test sheet, also try it with Mana 1.

Test result:

What should happen: With Mana 3, the rule requests spending 2, then rolls. With Mana 1, it only shows the message. The test describes actions without subtracting points from a real character.

Also check: The line from the spending to the roll sets the order: keep it. In real use, the spending is not refunded automatically if something goes wrong with the roll.

Heal without exceeding the maximum

Goal: ask how much to heal and add it to Health without exceeding its maximum. On your sheet, use a button action or a card's On use automation.

Follow these steps

  1. Open the example in the editor and click Ask. See that the question asks how much to heal and that the answer type is Number. Keep the Step name as Ask, because the formula uses that name.
  2. Follow the Answer line to Change value. Click it and see the target current Health and the Set operation. On your sheet, pick that field with Pick on the sheet.
  3. In Value, in Expression mode, there is clamp(@vida + $("Ask"), 0, @vida_max). It adds the answer to Health and keeps the result from going below 0 or above maximum Health.
  4. Open the test result. In the test, number questions are answered with 0, so Health 8 stays at 8. To see real healing of 5, use a test sheet and answer 5: with maximum 10, Health goes to 10.
  5. See that Ask's Cancel output is not connected to anything. Cancelling the question then ends the rule without changing Health.

Test result:

What should happen: Health 8, maximum 10 and answer 5 produce Health 10. The editor uses answer 0 in the simulation and shows Health 8. This is expected: the player answers the question in real use.

Also check: Set replaces Health with the calculated total. Add would add that total to Health again; so keep Set with this formula.

An item that adds +1d4 to Agility skills

Goal: a card adds a four-sided die to Agility rolls. On your sheet, open the card's On roll automation and choose the skills or block that should start it.

Follow these steps

  1. Open the example in the editor. Click Trigger and see that the rule responds to On roll. On your card, also check which rolls are selected.
  2. Click If and read $event.attribute == "agilidade": the question is “is this an Agility roll?”. On your sheet, choose the attribute in the visual builder to use the correct internal name.
  3. Follow the Yes path to Add to roll. The formula +1d4 adds a four-sided die to the roll that is about to happen.
  4. See that No has no action: rolls of other attributes follow it and do not get the extra die. In real use, test an Agility skill and one from another attribute.

Test result:

What should happen: An Agility roll receives +1d4 before calculation. Another attribute's roll receives no extra part. This example's simulation uses Agility.

Also check: agilidade is the attribute's internal name in this example; on your sheet it may be different. This rule decides the extra die before the roll has a total.

Count equipped cards

Goal: receive a +1 bonus per equipped card. Open a bonus calculation. This example has two equipped cards, Sword and Shield, and an unequipped Potion.

Follow these steps

  1. Open the editor and click Filter list. Check Step name: Equipped. The Resources source means the sheet's resource cards.
  2. Check the filter $item.equipped == true. It asks each card whether it is equipped. Only cards answering Yes stay in the list.
  3. Click Sum or count. Check Step name: Count, the Count operation and the Expression list $("Equipped"). This counts cards that passed the filter.
  4. Click Bonus. Check the Expression value $("Count"): it uses the previous step's count as the bonus. Formula names must match the step names.
  5. Check Bonus +2 in the result. On your test sheet, unequip a card and check that it drops to +1; with no equipped cards, it should be 0.

Test result: Bonus +2

What should happen: The example's two equipped cards give +2. Each card counts once, even if its quantity field lists multiple units.

Also check: To count units, use Sum and enter the quantity field. To count cards, keep Count.

Let the player choose a skill to receive +1

Goal: choose a skill and increase its extra bonus by 1. Use an action, such as a card's On use. The sample sheet offers Acrobatics for this choice.

Follow these steps

  1. Open the example and click Choose. Check Step name: Choose. This example uses Own options and offers Acrobatics with the sample sheet's field attached.
  2. Follow Chosen to Change value. Check the Add operation and Fixed value 1.
  3. Check the Expression target $("Choose").targets.misc. It reads the extra bonus field for the selected skill. You do not need to type the skill's name in this formula.
  4. Check the +1 change in the test result. On your own sheet, you can use the Skills source to offer the character's skills; check the choice and bonus increase on a test sheet.
  5. Leave Cancel without an action. Closing the choice without picking a skill then adds no bonus.

Test result:

What should happen: The chosen skill's extra bonus increases by 1 when the action runs. The simulation chooses Acrobatics automatically; it does not change your character's skill.

Also check: The test for the Skills source may use a sample item without an attached field. This example therefore uses Own options with a sample target. Check actual choices on a test sheet.

Remember how many times an ability was used

Goal: keep a counter that goes up on each use. Open the ability's use action. Memory is a value stored on the sheet, invisible to the player, that the rule can read on the next use.

Follow these steps

  1. Open the editor and click Store value. See Name: usos. That is the name the rule uses to store and read the counter.
  2. See the Sheet memory scope. Scope says how long the value lasts: Local lasts only while the rule runs; Sheet memory is kept for the next use.
  3. See the Expression value coalesce($sheet.memory.usos, 0) + 1. It reads the previous counter, uses 0 if there is none yet and adds 1.
  4. With the test on, see the value shown on the Store value step. The demo starts at 2 uses, so the next would be 3. That value appears only on the step itself, not in the What the test would do list. Repeating the test saves nothing, so it always starts again from 2.
  5. On your test sheet, use the action twice. If the counter did not exist yet, it should store 1 and then 2.

Test result:

What should happen: Each real use increases the counter by 1. This guide's simulation shows the next write as 3 because sample memory starts at 2. The counter does not automatically appear as a visible field.

Also check: Use a name only this rule uses: other automations on the same sheet can read the same memory. Storing 0 resets the counter; storing null deletes the value.