WikilyWIKILY
All games8 Wikis · pick your game
Menu

Documentation

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

Named values a page can reuse anywhere with a token. A formula reads the others by name.

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 page
1.2.3what a reader sees

Change patchVersion once and every page using it updates on its own. You never hunt down pages by hand.

The Variables page

  1. Open your wiki and click Manage.
  2. Click Variables, then Add variable.
  3. Name it using letters, numbers and underscores. It cannot start with a number.
  4. Pick a kind, fill in its fields, and save.

There are five kinds:

Row linkPoints at one row in a table. Read its fields with a dot: {{dodo.hp}}.
Fixed valueA number, word or yes/no you type once.
Reader inputA number or choice a reader changes on the page. Formulas using it recompute live.
FormulaA saved calculation built from other variables, like roundUp(dodo.hp / 5).
DatasetA whole table a Lua script can read row by row.

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.

You write{{dodo.name}} has {{dodo.hp}} HP.
A reader seesDodo has 22 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.

  1. On Variables, add level as a Reader input.
  2. Set its type to Number, default 1, min 1, max 20. Save.
  3. On your page, drag a Reader input block from the palette and point it at level.
  4. 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.

NumberA box, or a slider with a live readout once you set both a min and a max. Add a unit like % or s and it prints beside the value.
WordA plain text box.
Yes / noA switch. In a formula it is a real yes/no, so you can write {{ hardcore ? 2 : 1 }}.
Choice listOne of a set of choices - see the four looks below.
Repeatable rowsRows the reader adds and removes, like a loadout's slots. Only a Lua formula can read these.

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:

DropdownThe default. Gains a search box past six choices.
Row of pillsEvery choice on show at once, one tap to switch. Best for difficulty, tier or game mode - up to six choices.
Picture gridOpens a panel of thumbnails with a search box. For choices that are icons, where a list of file names tells a reader nothing.
Cards with detailsOpens a panel of cards - picture, name, a line of description, small stat chips - with a search box that matches the stats too.

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:

ColumnThe value the variable actually holds - what your formula gets.
Show instead of the valueA nicer name column: "Fireball", not a row key.
Picture columnThe column holding each row's image name or URL.
Description columnOne line under the name.
Stat columnsColumn keys separated by commas. Each becomes a small chip - damage, mana cost, cooldown.

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:

WikiThe Variables page under Manage. Every page sees it.
LayoutA shared layout's Variables panel. Every page built from it.
PageThe page editor's Variables panel. Only that page.
BlockA box's own variables. Copy the box and they travel with it.

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

Live values live in the tokenA value follows a reader when the math is in the token. A saved Formula dropped in by its bare name is fixed when the page loads.
Typos never break a pageA token pointing at nothing shows nothing. Blank, not broken.
Show literal bracesEscape them: \{\{ renders as {{.
Translations keep tokensTranslate the words around a token and leave the token alone.

A full taming calculator on the Far Far West wiki is built from nothing but variables and formulas like these: see it live.