Track stats with story events
If your story keeps numbers — hit points, experience, levels, gold — you can write each change down where it happens in the manuscript, as a story event, and Leafbind keeps the running totals for you. No spreadsheet beside the book: the manuscript is the record.
An event says who changes, which number, and by how much. In the editor it shows as a small tag in the text, with the value it leaves behind:
The wolf’s teeth closed on her arm.
Waverly HP −10 → 80She ran.
Events are for you, not your readers. They are left out of the word count, and proofreading passes them through exactly as you wrote them.
The same events keep track of what a character holds, too: an inventory, status effects, skills. See Track items, effects and skills.
Give a character starting values
Section titled “Give a character starting values”Leafbind needs to know where a number starts. Open the character’s wiki entry and find Stats in its properties (Ctrl+Shift+T shows the properties panel); on an entry with no stats yet it starts folded shut, so select it to open it. Type a stat’s name and its starting value, such as hp and 100, and select Add. Each stat’s starting value can be changed later in the same place.
Starting values are optional. A stat without one is shown as ? until a checkpoint sets it: adding to an unknown number still gives an unknown number.
Stat names are lowercase and start with a letter: hp, xp, level, gold, hp-max.
Add an event
Section titled “Add an event”Put the cursor where the change happens and select + Event in the bar above the text, or press Ctrl+Shift+E. You can also right-click in the text and choose Add event…, or use Edit → Add event….
Fill in:
- Who: the character. Names come from the wiki as you type.
- Stat: the number that changes. Stats already in use are offered first.
- Change: − subtract, + add or = set to, and the amount. It starts on the way the stat usually goes: up for
xporlevel, down forhpormana, or whichever way that stat has mostly gone in your own events. Pick another and it stays. - Description (optional): a reminder of why, such as bitten by a wolf. Leafbind ignores it; you see it when you point at the event.
- Where: Here, in the prose puts the event at the cursor, and it counts from that point on. At the end of the scene adds it to the scene’s own list instead (see below).
Select Insert. The event appears in the text as a tag.
For example, when Waverly gains 10 xp: Who Waverly, Stat xp, Change + add and 10, Description gained 10 xp. The tag reads Waverly XP +10 → and the new total.
One event can change several stats. Select + Add a change for another row, such as drinking a potion: inventory − loses healing potion, then hp + add 20. The new row starts with the same character; select ✕ to remove a row. The description belongs to the whole event. To add a change to an event that is already in the text, click its tag and select + Add a change there.
A name that no wiki entry has is allowed, and kept. Leafbind marks it until an entry with that name exists. Click the event, and its dialog offers Create a wiki entry for the name. Whatever else is wrong with an event, such as HP going over its maximum, its dialog says too, as pointing at it does.
Type an event as you write
Section titled “Type an event as you write”You can also type an event straight into the text, without the dialog. Write a dot, the stat, +, - or =, and the number, then press Space or Enter:
.hp-3is an event for the scene’s POV character: Waverly HP −3.joe.xp+10is an event for Joe: Joe XP +10.
Only names your wiki knows are converted, so ordinary text that happens to look like this is left alone. The stat is letters only, with nothing between the parts. The bare .hp-3 form is for the scene’s POV character, or, when the scene names none, the project’s Narrator / POV (Project details & settings… → General, from the project’s name in the toolbar). If it has nobody to go to, it stays text and a short note above it says why.
Press Ctrl+Z straight after to get back exactly what you typed. To turn this off, clear Type events as you write in Preferences → Editing.
Read and edit an event in the text
Section titled “Read and edit an event in the text”The tag shows the change and the value after it: Waverly HP −10 → 80. Point at it to see your words. When the total so far isn’t known, the value shows as ?.
Click the tag to change the event or delete it. It opens in the same dialog you added it with: change any field and select Save, or select Delete to remove it. Ctrl+Z undoes either. In a locked scene the dialog only shows the event. Clicking an event in the preview opens the same dialog, where you can change it too. In Preview alone, with no editor beside it, Ctrl+Z can’t undo that change; the scene’s history has the text before it.
Drag the tag to move the event to another place in the scene: point at it, and a handle of six dots appears at its left. Drop it where the change happens; it lands after the word you drop it on, never inside one. The totals follow, because an event counts from where it stands. Ctrl+Z moves it back.
The preview shows events the same way, with their totals.
You can also move the cursor into an event with the arrow keys. It then shows as text, which you can edit like any other text, and becomes a tag again when the cursor leaves. As text, an event looks like this:
{>>! waverly.hp -10 — bitten by a wolf<<}You can type events directly in this form if you prefer. The parts are:
waverly.hp: who, a dot, and the stat;-10,+20or= 7: the change;- after a dash with a space either side (
—or--): your own words, optional.
Several changes can share one event, separated by commas:
{>>! waverly.hp -10, waverly.poisoned +1 — wolf bite<<}The dialog shows each of them as a row of its own.
An event that doesn’t follow this form shows as a red tag. Point at it to see what’s wrong, then click it: the dialog lays it out as far as it reads and says what is missing. For example, with the + left out, Change waits for you to choose.
Write what the page says: a checkpoint
Section titled “Write what the page says: a checkpoint”= n sets a stat to a value rather than changing it. It’s the event to use where the text itself states the number, such as a status window:
{>>! waverly.level = 7 — status window<<}A checkpoint is also a check on your arithmetic. If the changes so far don’t add up to the value it sets, its tag turns amber, and pointing at it says what the changes add up to. Nothing is blocked: the checkpoint’s value is the one that counts from then on, so a missed change costs one warning, not every number after it.
If your text shows the reader a whole status window, insert it as one instead: each number you give on it is a checkpoint like this, and the rest Leafbind works out for you.
Events that belong to the whole scene
Section titled “Events that belong to the whole scene”Some changes belong to a scene, not to a sentence in it: the outcome of a fight the text skips over, or a night’s rest. Add these with Where: At the end of the scene, or in the properties panel under Events at the end of this scene: select Add event… and fill in the same dialog.
Each event in the list is a tag showing what it does to the totals. Click it to change or delete it, in the same dialog. A red tag opens the way it does in the text.
Events in this list count at the end of the scene. They aren’t in the totals anywhere inside it, and they are from the next scene on.
Locked scenes
Section titled “Locked scenes”A locked scene’s events can’t change: Add event… is not offered there, and its Events at the end of this scene list is read-only.
A worked example
Section titled “A worked example”The sample project has all of this in it. Create a copy of The Hedge Healer from Tutorials… in the ? menu, open Chapter 2, The Lake, and open the properties panel (Ctrl+Shift+T). Waverly starts the chapter as Chapter 1 left her, and the chapter holds:
- an event in the prose where she wades into the lake: effects + gains chilled;
- one event with three changes where she stitches the wolf’s wound: hedge-healer-level + 1, skills + gains beast-mending and xp + 60;
- a status window that states her XP as 425: a checkpoint;
- two events at the end of the scene, a night’s sleep: hp + 10 and effects − loses chilled. They are in the properties panel, under Events at the end of this scene.
Move the cursor down through the chapter and watch Stats at the cursor (see See every stat at any point in the book):
| Cursor | HP | XP | HEDGE-HEALER-LEVEL |
|---|---|---|---|
| at the top of the chapter | 46 | 365 | 3 |
| after the event with three changes | 46 | 425 | 4 |
| anywhere else in the chapter | 46 | 425 | 4 |
| at the top of Chapter 3 | 56 | 425 | 4 |
The night’s sleep counts from Chapter 3 on, never inside Chapter 2.
Now click the event with three changes and change xp + 60 to + 50. The status window’s XP row turns amber: the events before it add up to 415, not the 425 it states. Ctrl+Z puts it back.
To type an event, put the cursor after a word in Chapter 2, type .hp-5 and press Space. Every scene in the sample names Waverly as its POV, so the event is hers. Chapter 1 doesn’t take it: it is locked.