Variables and formulas
Updated 2026-08-16
A variable is a value you name once and use anywhere. A formula works out a new value from other variables. Change the value in one place and every page using it follows.
What variables are
Drop a variable onto a page by typing its name in double curly braces. Wikily swaps the token for the real value every time the page loads.
{{patchVersion}}what you type on the page1.2.3what a reader seesChange patchVersion once and every page using it updates on its own. You never hunt down pages by hand.
The Variables page
- Open your wiki and click Manage.
- Click Variables, then Add variable.
- Name it using letters, numbers and underscores. It cannot start with a number.
- Pick a kind, fill in its fields, and save.
There are five kinds:
{{dodo.hp}}.roundUp(dodo.hp / 5).Using tokens
A token works anywhere you can type: a heading, a paragraph, a caption, a button label, a table cell. Mix as many as you like into one sentence.
{{dodo.name}} has {{dodo.hp}} HP.Writing formulas
The same language works in a Formula variable and straight inside a token, like {{ roundUp(dodo.hp / 5) }}.
+ - * / %Add, subtract, multiply, divide, remainder. Parentheses set the order.== != < >Compare two values. Each gives a yes or no answer.a ? b : cPick between two results: dodo.hp > 20 ? "tough" : "weak".The functions Wikily understands:
round(x)To the nearest whole number.roundUp(x) ceil(x)Always up. Two names for the same thing.roundDown(x) floor(x)Always down.abs(x)Drops the sign.min(a, b)The smallest of a list. max(a, b)The largest of a list.clamp(x, lo, hi)Keeps a number inside a range.pow(x, y) sqrt(x)Powers and square roots.concat(a, b)Joins words together.upper(x) lower(x)All capitals, or all lowercase.A pipe dresses a value up for display without changing the number underneath:
{{ x | number }}12000 reads as 12,000.{{ x | round(1) }}3.14159 becomes 3.1.{{ x | percent }}0.25 becomes 25%.Build a calculator step by step
The smallest live calculator is a reader input plus a token that does the math.
- On Variables, add
levelas a Reader input. - Set its type to Number, default 1, min 1, max 20. Save.
- On your page, drag a Reader input block from the palette and point it at
level. - Anywhere on the same page, write
Level {{ level }} needs {{ level * 2 }} bullets.
Drag the control to 9 and the sentence becomes “Level 9 needs 18 bullets” with no page reload.
The math has to sit inside the token. That is what makes it recompute as the reader moves the control.
What kind of control a reader gets
A reader input's Value type decides the control. You never pick the widget itself - the same Reader input block draws whichever one the variable asks for.
A Choice list also has a Show as setting. All four store exactly the same value, so you can change it on a live page without breaking a formula or a link somebody already shared:
Choices that carry their own picture and stats
Set Choices from to A table column and the choices come from your data instead of a list you type - so a new spell shows up in the picker the moment it is added to the table. The columns below it are what a reader sees:
Only the value column is stored. Everything else is display, read fresh from the table on every render - so a balance patch that changes a spell's damage changes the picker with it, and nothing you built on top of the choice has to change.
The name and description columns are worth setting even for a plain dropdown: it uses the nicer name too.
Where a variable lives
A variable lives at one of four levels, from widest to narrowest:
An inner level sees everything above it. Where the same name exists twice, the inner one wins, so a self-contained calculator can use an obvious name like level without checking the wiki first. Reach past it with {{ wiki.level }}.
Values flow inward only. A wiki variable can never read a page variable, and a page variable can never read a block variable.
Prefer the narrowest level that works. A page only loads the variables it can see, so a calculator kept on its own page costs every other page nothing.
Going further
Plain formulas cover most day-to-day math. For several steps, a loop or a lookup, a formula can switch to a small Lua script.
Good to know
\{\{ renders as {{.A full taming calculator on the Far Far West wiki is built from nothing but variables and formulas like these: see it live.






