Guide
The Loom Engine
Make your stories feel authored, reactive, and alive — without writing a single line of code.
The Loom Engine is a behind-the-scenes scripting system built into every world. It lets you set up rules that silently guide the AI's writing during live gameplay. Think of it as a stage director that the audience never sees — shaping plot twists, tracking choices, introducing characters, and reacting to everything the player does.
Invisible
Players never see threads running. They just experience a story that reacts to them in surprising, intentional ways.
No Code Needed
Build everything in the visual editor by picking conditions and writing directions. Formulas and scripts are there when you want more.
Powerful
Dice rolls, stat meters, quests, inventory, branching choices, timed reveals, hidden plot logic — all possible.
The core concept
Every rule in the Loom Engine follows a simple pattern: IF something is true about the current moment in the story, THEN do something about it. These rules are called Threads. They run silently every time the AI writes a response.
IF
The player mentions "the sword"
THEN
Tell the AI: "The sword begins to glow with ancient runes"
Fundamentals
Threads
Each thread is one rule. Name it, give it conditions, give it actions, and let it run.
A thread is the building block of the Loom Engine. You create threads in the Loom Editor — a dedicated full-screen workspace you open from your world's Settings page.
Each thread has a name (so you can identify it), an enabled toggle (to turn it on or off), and a color (for visual organization). Threads are listed in a sidebar, and you click one to edit its details.
Thread settings
Priority
A number from 1 to 100. Higher-priority threads run first each turn, and threads with the same priority run in list order. Default is 5.
Condition Logic
Choose AND (every condition must pass) or OR (any one condition passing is enough). This controls how multiple conditions on the same thread work together.
Fire Once
When enabled, the thread fires at most one time per playthrough. Perfect for one-shot story beats like a villain reveal or a plot twist that should only happen once.
Max Fires
Limits how many times a thread can fire per playthrough. Set it to 3, and after the third firing the thread stops. Leave empty for unlimited.
Cooldown
After firing, the thread waits at least N messages before it can fire again. Great for recurring events you don't want to spam — like a weather system that changes every 5 messages.
Tags
Freeform labels you attach to threads (like "act_1" or "combat"). Use them to filter threads in the sidebar, and to enable or disable entire groups of threads at once with a single action.
The IF side
Conditions
Conditions decide when a thread fires. Pick from 56 condition types in 10 groups.
Every condition answers a yes-or-no question about the current moment: "Did the player say a keyword?", "Is a flag set?", "Has a lore card been triggered?" You can stack multiple conditions on one thread and choose whether all must pass (AND) or just any one (OR).
Message contains any keyword
Fires if the player's message includes any word from a list you define. Great for reacting to specific topics.
Message contains all keywords
Fires only if every keyword in your list appears. Use this for very specific triggers like "attack the dragon".
Message excludes keywords
Fires only when none of your listed words appear. Useful for "do this unless the player mentions X".
Message starts with
Fires when the message begins with a specific phrase, like "/roll" or "I cast".
Input mode is
Fires when the player writes in a specific mode: Do, Say or Custom.
Is continue action
Fires when the player clicks Continue (letting the AI write without input).
Action count ≥ / ≤ / = / in range
Check how many messages have been sent in this playthrough. "Action count ≥ 10" fires from message 10 onward.
Every Nth action
Fires on a repeating cycle. "Every 5th action" fires at messages 5, 10, 15, 20... Great for periodic events.
Is first message
Fires only on the very first player message of the playthrough. Perfect for opening scenes.
Flag equals / not equals
Check if a flag you've set has a specific value. "quest_stage equals 2" fires when you're in act 2.
Flag exists / not set
Check whether a flag has been created at all, regardless of its value.
Flag is truthy / falsy
Treats flag values as true/false. "false", "no", "0", and empty are falsy — everything else is truthy.
Counter ≥ / ≤ / = / in range
Compare a numeric flag against a threshold. "reputation ≥ 10" fires when the player's reputation reaches 10.
Flags with prefix ≥ N
Counts how many flags start with a prefix. "collected_item_ ≥ 3" means the player has collected 3+ items.
All/Any flags equal
Check multiple flags at once. "All flags in [quest_a, quest_b, quest_c] equal done" fires when all three quests are complete.
Lore card triggered / not triggered
Fires when a specific lore card was (or wasn't) included in the current AI prompt based on keyword matching.
Any / All lore triggered
Check sets of lore cards — did any of them trigger, or did all of them?
Triggered lore count ≥ N
Fires when a certain number of lore cards triggered in this prompt.
Lore card is active / inactive
Check whether a lore card's "Active for Prompt" toggle is currently on or off.
Lore ever / never triggered
Check if a lore card has triggered at any point during this playthrough — not just this message.
Thread has fired / has not fired
Check whether another thread has fired at any point this playthrough.
Thread fire count ≥ N
Has another thread fired at least N times?
Thread fired recently
Did another thread fire within the last N messages?
All / None / Sequence
Check sets of threads: have they all fired? None fired? Fired in a specific order?
Actions since thread
Have at least N messages passed since another thread last fired?
Player has item
Fires when the player is carrying a specific item — optionally at least N of it. "Has Iron Key" can gate a locked-door scene; "Has 3 Gold Coins" can gate a purchase.
Player lacks item
Fires when the player does not have an item. Great for "the merchant won't trade until you find the token" style gates.
Random chance
Fires with a percentage chance you set. "30% chance" means roughly 1 in 3 messages will trigger this.
Scaling random chance
Starts at a base chance and increases each message. "Start at 5%, increase 5% per message, max 50%" — tension that builds over time.
Dice check (DC)
Roll dice using standard notation (1d20, 2d6+3) against a difficulty number. The thread fires if the roll meets or beats the target. Results are shown to the player as an animated notification.
NOT (invert)
Wraps another condition and flips its result. "NOT message contains help" fires when the word "help" is absent.
AND / OR (nested)
Group conditions inside a single condition. Lets you build complex logic like "(A AND B) OR C".
N of M
Fires when at least N out of M sub-conditions are true. "2 of 3" means any two out of three must pass.
NONE of
Fires when none of its conditions are true. "None of noise, light or being seen" lets a stealthy player slip past.
Exactly N of / At most N of
Count how many conditions are true. Exactly 1 of 2 is an either-or; at most 1 of 3 allows one slip but not two.
Compare two values
Weigh any two values against each other with no code: variables, numbers, text, the turn, how often a thread fired, when it last fired, how many of an item the player has, or a formula. "Times Wolves attack fired is more than times Bandits attack fired."
Formula
One line that is true or false, such as gold >= price * 2 and said("buy"). See Formulas & Scripts below.
React when the player asks about the prophecy
A simple keyword trigger that adds flavor when a specific topic comes up in conversation.
Message contains any keyword: "prophecy", "foretold", "chosen one"
Inject narrative: "The air grows cold. The old man's eyes widen — he grips the player's arm. 'You've heard the words, then. The prophecy is no myth.'"
Thread: Prophecy Mention
The THEN side
Actions
Actions are what happens when a thread fires. You get 55 action types in 8 groups.
Every action does something concrete — inject text into the AI's instructions, set a flag, activate a lore card, show a notification, roll dice, or control other threads. Actions execute in the order you list them, so you can chain multiple effects.
Narrative Injection
The most important action type. You write a piece of creative direction, and the AI weaves it into its response. The player never sees your instruction — they just experience the result.
Inject narrative
Tell the AI to work a specific event, detail, or plot point into its response. The most flexible and commonly used action.
Inject dialogue
Force a named character to say specific words. "Innkeeper says: You're not welcome here anymore."
Inject environment
Describe a change in the surroundings. "A thick fog rolls in from the river. Visibility drops to ten feet."
Scene transition
Force the story to a new location or time. "Cut to three days later. The party arrives at the mountain pass."
Flashback & Foreshadowing
Weave in memories of the past or plant seeds for the future. Subtle, atmospheric storytelling tools.
Present choices (text)
End the AI's response with a numbered list of options. For real tappable choice buttons, see Interactive Choices in the Feedback section.
Inject into character profile
Automatically add text to the player's character profile for this session. Great for persistent character evolution based on story events.
The innkeeper recognizes a wanted criminal
When the player enters a tavern with a bounty on their head, the innkeeper reacts.
Message contains any keyword: "tavern", "inn", "bar"
Flag equals: wanted = true
Inject dialogue: The innkeeper's face drains of color. She drops a glass. "You... you're the one from the posters."
Set flag: innkeeper_alerted = true
Thread: Bounty Recognition
World State & Flags
Track anything across your story with named variables. Choices remembered. Progress tracked. Consequences earned.
World state is a set of named values (called flags) that persist for the entire playthrough. Think of them as sticky notes the Loom Engine can write and read.
A flag has a name (like quest_stage) and a value (like 2). You set flags with actions and check them with conditions.
What you can do with flags
Set a value
Set act to 2 — now any thread can check which act you're in.
Toggle a boolean
Flip door_locked between true and false each time the player interacts.
Increment a counter
Add 1 to reputation each time the player does something honorable.
Decrement with a floor
Subtract from health but never go below 0.
Random value
Set weather to a random choice from "sunny", "rainy", "stormy".
Batch set
Set multiple flags at once when initializing a new scene or quest.
Three-act story progression
Use a simple flag to transition the story through three acts.
Action count ≥ 15
Flag equals: act = 1
Set flag: act = 2
Inject narrative: "The ground trembles. A tower of black glass rises from the earth."
Activate lore card: The Obsidian Spire
Thread: Begin Act 2
The RPG layer
Meters, Quests & Inventory
Give players a living HUD — stat bars, quest logs, and a real inventory the story reacts to.
Beyond invisible logic, the Loom Engine can surface visible RPG systems. They appear in the Adventure HUD — a compact, collapsible panel that floats at the top-left of the story and stays out of the way. Everything here is built from the same flags and counters you already know, and it all updates live as you play.
Meters & stat bars
A meter is a labeled progress bar — Health, Sanity, Reputation, Affection — bound to a counter flag. Change the counter, fire Show meter, and the bar updates instantly in the HUD. You choose its label, max value, and color.
A health bar that drains on injury
Bind a meter to an hp counter, drop it when the player is hurt, and refresh the bar.
Message contains any keyword: "hurt", "wounded", "struck"
Decrement counter: hp by 15 (floor 0)
Show meter: "Health" → bound to hp, max 100, red
Thread: Take Damage
Quest tracker
Start a quest with a list of objectives, then tick them off as the player progresses. Quests appear in the HUD with a status — active, complete, or failed. Starting a quest and completing objectives also tell the AI, so the story acknowledges the player's goals. When a quest is done, Hide quest takes it off the HUD while it stays complete for your conditions and formulas.
Start / set quest
Open a quest in the tracker with a title and a list of objectives. Each quest has a stable ID you reference later.
Update quest
Mark an objective complete, or set the whole quest to complete or failed. The change is reflected in the HUD and described in the story.
Hide quest
Take a quest off the HUD. It keeps its status and objectives, so quest() and your conditions still read it, and Update quest brings it back. Leave the quest empty to hide every complete or failed quest at once.
A multi-objective main quest
Open the quest on the first turn, then complete an objective when the player finds the map.
Is first message
Start quest: "The Lost Heir" → Find the old map · Reach the ruined keep · Recover the signet
Thread: Start Main Quest
Inventory
Inventory items are first-class — defined once, then referenced everywhere. Give item defines an item (name, quantity, optional description). Remove item and Use / consume item let you pick from items the player actually has. Items stack with quantities and show in the HUD, and the Player has item condition gates content on what they carry.
Not everything worth tracking is an item. Give an item a category, such as Gossip, Clues or Contacts, and the HUD lists it under that heading instead of Inventory. Categories change only where an entry shows: it works with Remove item, Use item, has() and Player has item like any other item.
Give item
Add an item to the player's inventory with a quantity and description, or to a category of your own. This defines the item so other actions and the “has item” condition can reference it.
Remove item
Remove an item the player owns — picked from a dropdown of items your Give-item actions defined, so you never retype a name.
Use / consume item
Consume an owned item and tell the AI to show its effect in the scene — perfect for potions, keys, and consumables.
A key that unlocks a door — and is spent
Gate the door on owning the key, then consume it as the lock turns.
Message contains any keyword: "door", "gate", "unlock"
Player has item: Iron Key
Use item: Iron Key
Inject narrative: "The iron key fits the lock and turns with a heavy click — the way is open."
Thread: Unlock the Door
A gossip list of its own
File rumors about the band under Gossip, so the HUD shows them apart from the gear they carry.
Message contains any keyword: "interview", "paparazzi"
Give item: "Backstage feud" → category Gossip
Increment counter: scandal by 1
Thread: Tabloid Rumor
The Adventure HUD
Players see a small floating pill with glanceable mini-bars. Tapping it expands a full panel with every meter, quest, item and category (a bottom sheet on mobile). It persists for the whole playthrough and updates live as threads fire.
The Variables panel
In the editor, Variables lists every variable, item and quest your threads use, and which threads use each one. Rename or remove a variable everywhere at once, formulas and scripts included, and see its current value in any of your stories.
Dice Rolls
Add tabletop-style randomness. Roll dice, check against targets, and branch the story based on outcomes.
The Loom Engine supports standard dice notation — the same kind used in tabletop games. Write 1d20 for one twenty-sided die, 2d6+3 for two six-sided dice plus 3, or 4d6kH3 to roll four dice and keep the highest three.
When dice roll, players see an animated notification showing the result, the target number, and whether they succeeded or failed.
As a condition: Dice Check
Roll dice and compare against a target number (DC). If the roll meets or beats the DC, the condition passes and the thread fires.
Example: "Roll 1d20 vs DC 15 — if they pass, they successfully pick the lock."
As an action: Roll + Branch
Roll dice and inject different narrative text based on the outcome — success, failure, critical success, or critical failure.
Example: "Roll 1d20+5 vs DC 12 — on success the bridge holds, on failure it collapses."
Combat encounter with dice
When the player attacks, roll for success. The story branches based on the outcome.
Message contains any keyword: "attack", "strike", "swing"
Roll dice + check: 1d20+3 vs DC 13
On success: "Your blade finds its mark. The creature howls and staggers."
On failure: "Your swing goes wide. The creature lunges."
Store result in flag: last_attack_roll
Thread: Attack Roll
Lore Card Control
Threads can activate, deactivate, pin, and even rewrite your lore cards on the fly.
Lore cards define what the AI knows about your world. The Loom Engine lets you dynamically control which lore cards are active, ensuring the AI only knows what it should at any given point.
Activate / Deactivate
Turn a lore card on or off. "Deactivate the Village card and activate the Ruins card" — the AI now knows about the ruins, not the village.
Pin / Unpin
Pinned cards are always included in the AI's context, regardless of keyword matching. Pin critical characters during their scenes.
Temporary pin
Pin a card for exactly N messages, then it auto-unpins. Perfect for introducing a character that's important for a scene but not the whole story.
Swap description
Rewrite a lore card's description mid-story. The "Village" card starts peaceful, then changes to describe a burning ruin after an attack.
Change importance
Boost or lower a card's priority. Make a character more prominent as they become important to the plot.
Reveal a hidden villain
When the player discovers the truth, swap out the friendly NPC's lore card for the villain version.
Flag equals: clues_found = 3
Thread has not fired: Villain Reveal
Swap lore description: "Aldric" → villain version
Pin lore card: Aldric the Merchant
Inject narrative: "Something in Aldric's smile changes. His eyes are cold now."
Show achievement: "Truth Unveiled"
Thread: Villain Reveal
Player Feedback & Choices
Show notifications, achievements, hints, and notes — and offer tappable choices that branch the story.
Sometimes you want to communicate directly with the player outside the story. Feedback actions display visual messages the player sees but the AI does not — and interactive choices let the player steer the next turn with a tap.
Notifications
Brief pop-up banners in four styles: info, success, warning, and lore. Use them for quest updates, story hints, or atmospheric messages.
Achievements
A special notification styled like a video game achievement unlock. Reward players for discoveries, milestones, or hidden interactions.
Hints
A subtle text hint near the input field. Guide the player without breaking immersion: "Try looking behind the painting."
Narrator Notes
A styled message that appears in the chat timeline. Visible to the player but never sent to the AI.
Interactive Choices
Tappable choice buttons that appear above the input. The player taps one and it is submitted as their next action — branching the story with a single click. (The text-only "Present choices" action lists options in the prose instead.)
Thread Control
Threads can enable, disable, reset, and force-fire other threads — enabling multi-phase storylines.
This is where the Loom Engine becomes truly powerful. Threads don't just react to the story — they can control each other.
Enable / Disable thread
Turn another thread on or off at runtime. "When Act 1 ends, enable all Act 2 threads."
Reset thread
Reset a thread's fire count and cooldown, as if it had never fired. Useful for repeating story beats.
Force fire thread
Immediately trigger another thread, skipping its conditions. Chain reactions of narrative events.
Schedule thread
Set a thread to enable itself after N messages. "Schedule the ambush in 5 messages" — delayed events.
Enable / Disable group
Control all threads with a specific tag at once. Tag your Act 1 threads as "act_1", then disable the entire group with one action.
Multi-act story orchestration
Thread control enables seamless act transitions.
Flag equals: quest_complete = true
Action count ≥ 20
Disable thread group: act_1
Enable thread group: act_2
Set flag: act = 2
Inject narrative: "The quest is complete — but the real story is just beginning."
Show notification: "Act 2: The Reckoning"
Thread: Transition to Act 2
When you want more
Formulas & Scripts
Compare anything and write a few steps of logic in one place. Optional, and there when you need it.
Most worlds never need code. When you want more, Loom has a small language made for stories. It reads close to plain English, and the editor checks it as you type.
Formulas are one line that works something out, like gold >= price * 2. Use one as a condition, as a side of Compare two values, in the Calculate a value action, or inside any action text between double braces.
Scripts are several lines with if and else. A script can change variables, keep values of its own with let, and run any other action by its name, like give_item("Lantern").
A formula condition
said("buy") and gold >= priceTrue when the player says buy and can pay.
One thread against another
fired("Mercy Shown") > fired("Cruelty Shown")Threads are named in quotes. Renaming a thread updates the formulas that name it.
Text that fills itself in
You have {{gold}} gold, or {{ gold * 10 }} silver.Works in the text of any action, with a variable or a whole formula.
A short script
let price = 10
if gold >= price then
gold -= price
give_item("Lantern")
else
show_hint("You need more gold.")
endlet keeps price for this script only. Everything else is saved with the story.
The language at a glance
12
A number. Decimals work too, like 2.5.
"the old mill"
Text, in straight or curly quotes.
true
Yes or no: true and false.
gold
A variable. One that isn’t set reads as 0 beside a number and as empty text beside text.
gold + 5
Add, subtract, multiply, divide and take the remainder with + - * / %. Text joins with +.
hp <= 0
Compare with == != < <= > >=. In a formula a single = also means equals.
gold >= price and not banned
Combine with and, or and not, or with && || !.
hp > 50 ? "strong" : "weak"
Pick one of two values: test ? if true : if false.
gold = gold - 5
Change a variable. It is saved with the session.
gold -= 5
Short forms: += -= *= /=.
let price = 12
A value for this script only. It isn’t saved, and it hides a variable with the same name.
unset quest_step
Remove a variable.
if gold >= 10 then gold -= 10 elseif gold > 0 then gold = 0 else show_hint("Your purse is empty.") end
Choose what runs with if, elseif, else and end.
show_toast("Saved the village", "success")
Run any action by its name, on its own line. A script can run up to 25 of them each turn.
# Notes for yourself
Anything after # or // is a comment.
You carry {{gold}} gold.
Any action text can show a variable’s value.
That costs {{ price * 2 }} gold.
Or the result of a formula. Inside a script, let values work here too.
Functions
min(a, b, …)
The smallest of the values. Example: min(hp + 20, max_hp)
max(a, b, …)
The largest of the values. Example: max(gold - price, 0)
clamp(value, low, high)
The value, kept between low and high. Example: clamp(hp - damage, 0, 100)
round(value, places)
Rounds to whole numbers, or to a number of decimal places. Example: round(gold * 1.15)
floor(value)
Rounds down. Example: floor(xp / 100)
ceil(value)
Rounds up. Example: ceil(distance / 3)
abs(value)
The value without its minus sign. Example: abs(karma) >= 10
random(low, high)
A whole number from low to high, both included. Example: random(1, 6)
chance(percent)
True that percent of the time. Example: chance(25)
pick(a, b, …)
One of the values, chosen at random. Example: pick("rain", "fog", "clear skies")
roll("2d6+1")
Rolls dice quietly and gives the total. Use the dice actions when the player should see the roll. Example: roll("1d20") + strength
lower(text)
The text in lowercase. Example: lower(class) == "rogue"
upper(text)
The text in capitals. Example: upper(name)
length(text)
How many characters the text has. Example: length(message()) > 200
contains(text, part)
Whether the text includes the part anywhere, in any capitalization. Example: contains(title, "king")
startsWith(text, part)
Whether the text begins with the part, in any capitalization. Example: startsWith(message(), "I cast")
endsWith(text, part)
Whether the text ends with the part, in any capitalization. Example: endsWith(message(), "?")
number(value)
The value as a number, or 0 when it isn’t one. Example: number(answer) == 42
text(value)
The value as text, so + joins it instead of adding. Example: text(floor) + "F"
turn()
How many turns the session has had. The first turn is 0. Example: turn() >= 10
message()
What the player wrote this turn. Example: length(message()) < 20
said("word", …)
Whether the player’s words this turn include any of these, as whole words. Example: said("attack", "strike")
mentioned("word", …)
Like said(), but also reads the storyteller’s last reply, as keyword conditions do. Example: mentioned("dragon")
narrated("word", …)
Whether the storyteller’s last reply includes any of these, as whole words. Example: narrated("wounded", "bleeding")
lastReply()
The storyteller’s last reply, as it reads at the start of this turn. Example: contains(lastReply(), "storm")
mode()
How the player wrote this turn: "do", "say", "story" or "see". Example: mode() == "say"
continued()
Whether the player pressed Continue instead of writing. Example: not continued()
exists("name")
Whether a variable has been set. Example: not exists("met_the_king")
get("name")
A variable whose name you build: get("rep_" + faction). Example: get("rep_" + faction) >= 10
previous("name")
A variable as it was when this turn began, before any thread changed it. Example: hp < previous("hp")
changed("name")
Whether a thread changed this variable earlier this turn. Example: changed("hp")
fired("thread")
How many times a thread has fired in this session, before this turn. Example: fired("Wolves attack") > fired("Bandits attack")
lastFired("thread")
The turn a thread last fired on, or nothing if it never has. Example: lastFired("Met the king") < lastFired("Met the queen")
turnsSince("thread")
Turns since a thread last fired, or nothing if it never has. Example: turnsSince("Storm") >= 8
firedThisTurn("thread")
Whether a thread above this one in the order already fired this turn. Example: not firedThisTurn("Ambush")
enabled("thread")
Whether a thread is switched on in this session. Example: enabled("Night falls")
loreTriggered("card")
Whether a lore card is in this turn’s prompt. Example: loreTriggered("The Lighthouse")
loreActive("card")
Whether a lore card is switched on. Example: loreActive("Cursed Blade")
loreCount("card")
How many turns a lore card has come up in this session. Example: loreCount("Mira") >= 3
items("item")
How many of an item the player carries. Example: items("Arrow") >= 5
has("item")
Whether the player carries at least one of an item. Example: has("Rusty Key")
quest("id")
A quest’s status: "active", "complete", "failed", or "" before it starts. Example: quest("main") == "complete"
objectiveDone("id", number)
Whether a quest’s objective (counting from 1) is ticked off. Example: objectiveDone("main", 2)
Actions in a script
Every action runs from a script by its name. Give its values in the order listed, or by name, like give_item(itemName: "Rope").
inject_narrative("A storm rolls in off the sea.")
Inject narrative: Add a narrative directive to the AI prompt
direct_output("")
Direct output (bypass AI): Output text directly to player and skip AI generation for this turn
inject_dialogue("Mira", "Not another step.")
Inject dialogue: Force an NPC to say specific words
inject_environmental("Rain drums on the tin roof.")
Inject environment: Describe an environmental change
inject_transition("")
Scene transition: Force a scene/location change
inject_flashback("")
Inject flashback: Weave in a flashback moment
inject_foreshadow("")
Foreshadow: Add subtle foreshadowing
inject_choice_prompt(["one", "two"])
Present choices: Present labeled choices to the player
set_flag("met_the_king", "true")
Set flag: Set a flag to a value
remove_flag("variable_name")
Remove flag: Delete a flag
toggle_flag("variable_name")
Toggle flag: Flip a boolean flag
increment_counter("variable_name")
Increment counter: Add to a numeric flag
decrement_counter("variable_name")
Decrement counter: Subtract from a numeric flag
set_counter("variable_name", 1)
Set counter: Set a numeric flag to an exact value
set_flag_random("variable_name", ["one", "two"])
Random flag value: Set a flag to a random choice from a list
copy_flag("variable_name", "variable_name")
Copy flag: Copy one flag's value to another
clear_flags_by_prefix("")
Clear flags by prefix: Delete all flags matching a prefix
activate_lore("Card title")
Activate lore card: Set a lore card active for prompt
deactivate_lore("Card title")
Deactivate lore card: Set a lore card inactive
pin_lore("Card title")
Pin lore card: Pin a lore card (always included)
unpin_lore("Card title")
Unpin lore card: Unpin a lore card
pin_lore_temporary("The Lighthouse", 5)
Temporary pin: Pin a lore card for N actions
force_include_lore("Card title")
Force include (this prompt): Include in this prompt only
force_exclude_lore("Card title")
Force exclude (this prompt): Exclude from this prompt only
boost_lore_importance("Card title", 1)
Change importance: Change a lore card's importance level
swap_lore_description("Card title", "")
Swap description: Replace a lore card's description text
activate_lore_batch(["Card title"])
Bulk activate: Activate multiple lore cards
deactivate_lore_batch(["Card title"])
Bulk deactivate: Deactivate multiple lore cards
enable_thread("Act Two")
Enable thread: Turn on a disabled thread
disable_thread("Act One")
Disable thread: Turn off a thread
reset_thread("Thread name")
Reset thread: Reset fire count and last-fired
enable_thread_group("")
Enable group: Enable all threads with a tag
disable_thread_group("")
Disable group: Disable all threads with a tag
fire_thread("Ambush")
Force fire thread: Fire another thread (skip conditions)
schedule_thread("Reinforcements", 3)
Schedule thread: Enable a thread after N more actions
show_toast("Quest updated", "success")
Show notification: Show a brief notification banner
show_achievement("First blood", "Won your first fight")
Show achievement: Show an achievement popup
show_hint("Try asking the innkeeper.")
Show hint: Show a hint below the input
show_narrator_note("The door is locked from the inside.")
Narrator note: Show a styled note in chat (not sent to AI)
present_choices(["Fight", "Flee"])
Present tappable choices: Show clickable choice buttons in chat. Tapping one sends it as the player's next action.
show_meter("Health", "hp", 100, "rose")
Show meter / stat bar: Display a labeled progress bar (HP, reputation, sanity…) bound to a counter. Stays visible in the player's HUD.
show_quest("main", "Find the crown", ["Reach the castle", "Open the vault"])
Start / set quest: Add or replace a quest in the player's objective tracker with a list of objectives.
update_quest("main", 1)
Update quest: Mark a quest objective complete, or set the quest's status (active / complete / failed).
hide_quest("main")
Hide quest: Take a quest off the player's HUD. It keeps its status and objectives, so conditions and formulas still read it, and Update quest shows it again. With no quest chosen, every complete or failed quest is hidden.
give_item("Lantern", 1)
Give item: Add an item to the player's inventory (with a quantity). Defines the item so other actions can reference it. Give it a category, such as Gossip, to list it under its own heading instead of the inventory.
remove_item("Lantern")
Remove item: Remove an item the player owns — pick from items defined by Give item actions.
use_item("Healing Potion")
Use / consume item: Consume an item the player owns and tell the AI to show its effect in the scene.
roll_dice("", "variable_name")
Roll dice: Roll dice and store the result in a world state flag
roll_dice_check("1d20", 12)
Roll dice + check: Roll dice against a DC, inject narrative based on outcome
inject_player_context("")
Inject into character profile: Append text to the session's character profile
inject_session_notes("")
Add persistent memory: Append a fact to the session's persistent memory (session notes)
set_session_notes("")
Replace persistent memory: Replace the session's persistent memory (session notes) with new text
Get started fast
Templates & the Editor
One-click starter packs and a guided editor take you from idea to working thread in seconds.
The Loom Editor's Templates button adds ready-made threads in one step. It's the fastest way to learn by example. There are 53 of them across every genre, and each shows what its threads do before you add it. Open one, see how it's built, then change it however you like. A few of them:
Health System
A live HP bar that drains on injury and triggers a defeat beat at zero.
Romance Meter
An affection bar that warms and cools with tender or cold moments.
Branching Choices
Offers tappable choices every few turns to steer the story.
Quest Tracker
A multi-objective quest that ticks off objectives as you play.
Loot Drops
Chance-based item rewards when the player searches containers.
Three-Act Pacing
Escalates the story at turn milestones to keep a three-act shape.
Sanity Meter
A horror sanity bar that frays and warps the narration when low.
Reputation
A standing that rises and falls with heroic or villainous deeds.
Coin Purse
A gold currency meter you earn from loot and a starting purse.
Companion Bond
A loyalty meter with a payoff when a companion fully trusts you.
Skill Checks
Rolls a d20 check on risky-action phrases and shapes the outcome.
Inventory & Keys
Carry items, drink potions, and spend a key to unlock a door.
Merchant Shop
A script checks prices against your gold and refuses what you can’t afford.
Dice Combat
Attack rolls against a defense, with a health bar for you and the enemy.
Whodunit
A secret culprit picked at random, and one accusation to get right.
The editor helps as you build
Plain-English preview
Every thread shows a readable summary of what it does — “When HP ≤ 0 → show a defeat note” — so you always know what you're building.
Test a turn
Type what a player might write, start from a new story or one of yours, and see which threads fire and exactly what the storyteller is told. Nothing is saved to any story.
Import & export
Export your threads to a file and import them into another world — share systems or back up your work.
Publishing & Hidden Threads
Share your worlds with the community — and protect your secret narrative logic.
When you publish a world, all your Loom threads come with it. Players who download your world experience all the reactive storytelling you built.
But sometimes you want to protect your creative work. That's where hidden threads come in.
Hidden Threads
Mark any thread as "Hidden" in its settings. In your world, it works normally. But when someone downloads your world, hidden threads become completely invisible — they can't see, edit, or delete them.
They still fire and shape the AI's responses. The player experiences the effects without knowing how they work.
Loom Visibility
A world-level setting with two modes. Exposed (default): threads keep their individual hidden/visible status. Hidden: ALL threads are forced to hidden in downloaded copies.
Downloaders see a note saying how many hidden threads run in the world, and that the creator locked them.
Tips & Patterns
Proven patterns from experienced world creators.
Start simple, layer complexity
Begin with 2-3 threads that inject narrative on keyword triggers. Once you see them working, add world state flags, then thread control for multi-phase stories.
Use tags to organize
Tag threads by story act (act_1, act_2), by system (combat, weather), or by character. Then use "Enable group" and "Disable group" to manage them in bulk.
Write specific, vivid directives
Instead of "make it dramatic", write "The innkeeper slams her fist on the bar, sending mugs crashing to the floor." The more specific, the better.
Use Fire Once for big moments
Plot twists, character reveals, and major transitions should use Fire Once. You don't want the villain to reveal themselves repeatedly.
Cooldowns prevent spam
For atmospheric threads (weather, ambient descriptions), set a cooldown of 3-5 messages. Keeps the world alive without repetition.
Test before you play
Open Test in the editor and try the messages that should trigger your threads. It shows which conditions passed and what each thread did. Then play your world and check the Context Inspector to see it live.
Ready to build?
Open the Loom Editor in any world and create your first thread. Start with a simple keyword trigger — you'll be amazed at how much it changes the experience.