"""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'{text}' HOW_TO_HTML = f"""

This free DnD initiative tracker 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.

  1. Paste or type everyone into the quick-add box, one combatant per line. Players who already rolled get their number; monsters get a modifier and the tool rolls for them.
  2. Hit Add to Order. The list sorts itself highest-first instantly, and the roll log shows exactly what was rolled for whom.
  3. Run the fight with Next. 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.
  4. Fix ties or surprises by hand. 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.

The quick-add box understands a tiny syntax so one paste can set up a whole encounter:

You type What happens
{_code('Kira 18')} 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.
{_code('Goblin x3 +2')} 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.
{_code('Shadow')} 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.

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.

""" WHY_HTML = """

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.

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 after 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?"

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.

""" EXAMPLE_HTML = f"""

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:

Kira 18
Torvin 12
Goblin x3 +2
Owlbear +1
Shadow

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:

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

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.

""" RULES_HTML = """

A quick refresher on how initiative works by the book, and how this tool maps onto it:

""" 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 = ( '

' "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 " 'Loreify, an AI session-notes app for ' "D&D campaigns.

" )