| """Page copy: how-to, positioning, worked example, rules refresher, FAQs. |
| |
| One H1 lives in the hero; every heading here is rendered as an H2 by |
| section_html. The primary keyword appears in the first paragraph and in |
| the "Why This DnD Initiative Tracker Is Turn Order Only" H2. |
| """ |
|
|
| _TABLE_STYLE = ( |
| "width:100%;border-collapse:collapse;margin:0.75rem 0;" |
| ) |
| _CELL_STYLE = ( |
| "border:1px solid rgba(212,175,55,0.35);padding:0.55rem 0.8rem;" |
| "text-align:left;color:rgba(242,230,206,0.85);vertical-align:top;" |
| ) |
| _CODE_STYLE = ( |
| "background:var(--lf-panel-deep);color:var(--lf-gold);border-radius:4px;" |
| "padding:0.1rem 0.4rem;font-family:monospace;" |
| ) |
| _PRE_STYLE = ( |
| "background:var(--lf-panel-deep);color:var(--lf-cream);border:1px solid " |
| "rgba(212,175,55,0.35);border-radius:8px;padding:1rem 1.25rem;" |
| "overflow-x:auto;line-height:1.6;font-size:0.95rem;" |
| ) |
|
|
|
|
| def _code(text: str) -> str: |
| return f'<code style="{_CODE_STYLE}">{text}</code>' |
|
|
|
|
| HOW_TO_HTML = f""" |
| <p>This free <strong>DnD initiative tracker</strong> does exactly one job: it gets |
| your combat's turn order on screen and moving in seconds. No accounts, no encounter |
| prep, no stat blocks to fill in β type names into one box, let the tool roll for the |
| monsters, and hit Next until the fight is over. It runs entirely on this page and |
| remembers your order in your browser between visits.</p> |
| <ol> |
| <li><strong>Paste or type everyone into the quick-add box</strong>, one combatant per |
| line. Players who already rolled get their number; monsters get a modifier and the |
| tool rolls for them.</li> |
| <li><strong>Hit Add to Order.</strong> The list sorts itself highest-first instantly, |
| and the roll log shows exactly what was rolled for whom.</li> |
| <li><strong>Run the fight with Next.</strong> The current combatant is highlighted |
| with a gold border; when the last turn ends, the round counter ticks up |
| automatically. Back undoes an accidental click.</li> |
| <li><strong>Fix ties or surprises by hand.</strong> Select any combatant and use Move |
| Up / Move Down, or Remove them when they drop out. Copy Order exports the whole |
| list as plain text for your notes.</li> |
| </ol> |
| <p>The quick-add box understands a tiny syntax so one paste can set up a whole |
| encounter:</p> |
| <table style="{_TABLE_STYLE}"> |
| <tr> |
| <th style="{_CELL_STYLE}color:var(--lf-gold);">You type</th> |
| <th style="{_CELL_STYLE}color:var(--lf-gold);">What happens</th> |
| </tr> |
| <tr><td style="{_CELL_STYLE}">{_code('Kira 18')}</td> |
| <td style="{_CELL_STYLE}">Adds Kira with initiative 18 β use this when a player |
| calls out the total they rolled. Entries added this way are tagged as PCs in the |
| list.</td></tr> |
| <tr><td style="{_CELL_STYLE}">{_code('Goblin x3 +2')}</td> |
| <td style="{_CELL_STYLE}">Creates Goblin 1, Goblin 2, and Goblin 3, and rolls a |
| separate d20+2 for each one. Any {_code('+N')} or {_code('-N')} ending is treated |
| as an initiative modifier, so {_code('Owlbear +1')} rolls d20+1 for a single |
| owlbear.</td></tr> |
| <tr><td style="{_CELL_STYLE}">{_code('Shadow')}</td> |
| <td style="{_CELL_STYLE}">A bare name. With "Roll d20 for names without a number" |
| checked (the default), the tool rolls a straight d20; unchecked, it adds the |
| combatant at 0 so you can fill the roll in later by removing and re-adding.</td></tr> |
| </table> |
| <p>Every roll is reported in the log under the button β "Goblin 2 rolled 14 |
| (d20+2)" β so your table can see the dice were honest.</p> |
| """ |
|
|
| WHY_HTML = """ |
| <p>Most initiative tools want to run your whole encounter: hit points, conditions, |
| death saves, legendary actions, monster stat blocks. That power costs setup time, |
| and setup time is exactly what kills the momentum of "roll initiative!" at a real |
| table. This tracker deliberately refuses all of it.</p> |
| <p>Turn order is the one thing every combat needs within thirty seconds of the |
| words being spoken. By tracking only names, numbers, and whose turn it is, this |
| tool stays fast enough to set up <em>after</em> initiative has already been rolled β |
| one paste, one click, fighting. There is nothing to configure, nothing to import, |
| and nothing on screen that isn't the answer to "who's next?"</p> |
| <p>If you want the heavier machinery β hit points ticking down, conditions with |
| round counts, the full battlefield ledger β we build that too: our combat tracker |
| (linked in the tools section below) runs the whole battle. Use that one for the |
| boss fight you prepped; use this one for the ambush you didn't.</p> |
| """ |
|
|
| EXAMPLE_HTML = f""" |
| <p>Say your party of two meets an owlbear and some goblins in the dark. The players |
| call out their totals, and you paste this into the quick-add box:</p> |
| <pre style="{_PRE_STYLE}">Kira 18 |
| Torvin 12 |
| Goblin x3 +2 |
| Owlbear +1 |
| Shadow</pre> |
| <p>The tool rolls five dice (three goblins, the owlbear, and the shadow), reports |
| each roll in the log, and produces an order like this β yours will differ because |
| the d20s are real rolls:</p> |
| <pre style="{_PRE_STYLE}">Initiative Order β Round 1 |
| > 1. Kira β 18 (PC) |
| 2. Owlbear β 15 |
| 3. Goblin 2 β 14 |
| 4. Torvin β 12 (PC) |
| 5. Shadow β 9 |
| 6. Goblin 1 β 7 |
| 7. Goblin 3 β 4</pre> |
| <p>Kira is highlighted as the current turn. From here the whole fight is the Next |
| button: seven clicks per round, the round counter climbs on its own, and when |
| Goblin 2 dies you select it and hit Remove without disturbing whose turn it is.</p> |
| """ |
|
|
| RULES_HTML = """ |
| <p>A quick refresher on how initiative works by the book, and how this tool maps |
| onto it:</p> |
| <ul> |
| <li><strong>The roll.</strong> When combat starts, every creature makes a Dexterity |
| check: d20 plus their Dexterity modifier. The order runs highest to lowest and |
| repeats every round. That modifier is exactly what the quick-add |
| <em>+N</em> syntax expects β a goblin's DEX modifier is +2, so <em>Goblin x3 |
| +2</em> rolls initiative for three goblins by the rules.</li> |
| <li><strong>Ties.</strong> By the rules, the DM decides ties between monsters and |
| players (the common convention is higher Dexterity score wins), and players decide |
| ties among themselves. This tracker doesn't guess for you: when a tie needs a |
| specific order, select a combatant and use Move Up or Move Down to set it. The |
| manual order sticks as you cycle turns.</li> |
| <li><strong>Surprise.</strong> Fifth edition has no separate "surprise round": |
| surprised creatures roll initiative normally but can't move or act on their first |
| turn (in the 2024 rules, being surprised instead gives disadvantage on the |
| initiative roll). Either way, the order itself is tracked exactly the same β |
| add everyone and skip or adjust as your table rules.</li> |
| <li><strong>Groups.</strong> Many DMs roll once for a whole group of identical |
| monsters to save time. This tool supports both styles: <em>Goblin x3 +2</em> rolls |
| each goblin separately, while typing <em>Goblins 14</em> puts the whole pack on one |
| count.</li> |
| </ul> |
| """ |
|
|
| FAQS = [ |
| ( |
| "How does initiative work in D&D 5e?", |
| "When combat begins, every participant rolls a d20 and adds their Dexterity " |
| "modifier. Turns then proceed from the highest total to the lowest, and the " |
| "sequence repeats each round until the fight ends. This tracker automates " |
| "the bookkeeping half: enter each combatant's total (or a modifier to roll " |
| "for them), and it sorts the order and advances turns and rounds for you.", |
| ), |
| ( |
| "Who goes first on a tie?", |
| "By the rules, the DM chooses how to break ties involving monsters β the " |
| "common convention is that the creature with the higher Dexterity score " |
| "goes first β and tied players decide the order among themselves. When " |
| "you've settled it, select a combatant here and use Move Up or Move Down " |
| "to lock in the order; it stays put as turns cycle.", |
| ), |
| ( |
| "How do DMs speed up initiative?", |
| "Three habits do most of the work: have players roll the moment combat " |
| "looks likely and call out totals instead of rolls; pre-roll or group-roll " |
| "monsters; and keep the order somewhere everyone can see so nobody asks " |
| "\"am I up?\" This tool is built around exactly those habits β one pasted " |
| "block sets up the whole encounter, the modifier syntax rolls the monsters " |
| "for you, and the highlighted current turn answers the question before " |
| "it's asked.", |
| ), |
| ( |
| "Can my players see this screen?", |
| "Yes β that's the recommended way to use it. Project the page, share your " |
| "screen in your VTT call, or prop a tablet in the middle of the table. " |
| "Since the tracker shows only names and numbers (no monster HP or secrets), " |
| "there's nothing on screen you need to hide from players.", |
| ), |
| ( |
| "Does it save my order?", |
| "Yes. The current order, round, and turn are stored in your browser's " |
| "localStorage, so refreshing the page or coming back mid-session picks up " |
| "exactly where you left off. Nothing is uploaded anywhere β the data never " |
| "leaves your browser, which also means a different device starts fresh.", |
| ), |
| ( |
| "How is this different from the combat tracker?", |
| "This tool is turn order only, built for speed: names, initiative numbers, " |
| "whose turn it is, and what round you're on. Our combat tracker adds hit " |
| "points, conditions, and the rest of the battlefield bookkeeping. If your " |
| "fight needs HP tracking, use the combat tracker (linked below); if you " |
| "just need the order moving right now, this one gets you fighting faster.", |
| ), |
| ( |
| "Can it roll initiative for monsters automatically?", |
| "Yes. End a line with a modifier instead of a total β \"Owlbear +1\" rolls " |
| "d20+1 for the owlbear, and \"Goblin x3 +2\" creates three goblins and " |
| "rolls d20+2 separately for each. The roll log under the button shows " |
| "every result, like \"Goblin 2 rolled 14 (d20+2)\", so the rolls are " |
| "transparent to the table.", |
| ), |
| ] |
|
|
| DISCLAIMER_HTML = ( |
| '<p class="lf-disclaimer">' |
| "This is an unofficial fan tool. Dungeons & Dragons and D&D are " |
| "trademarks of Wizards of the Coast LLC. This tool is not affiliated with, " |
| "endorsed, or sponsored by Wizards of the Coast. The tracker is deterministic " |
| "β the only randomness is the d20 rolls you ask it to make β and your order " |
| "is stored only in your own browser. This tool is built and maintained by " |
| '<a href="https://loreify.ai">Loreify</a>, an AI session-notes app for ' |
| "D&D campaigns.</p>" |
| ) |
|
|