SAMPLE PROJECT WALKTHROUGH
Story States & Rules Workshop
Download the editable project, then choose Open Existing in the App. Save your current work before opening another project.
Download editable projectPlay Example (new tab)All Sample Projects
Story states, rules, and Test Lab
Open Gameplay → Story & rules and choose Story states & rules guide to return to this page. Use Test → Test Lab to run the actual game and inspect the results. These tools connect persistent story facts to the existing rooms, objects, NPCs, scripts and native features.
Story & Rules
A story state is a named fact such as Power restored. Choose Add story state, give it a useful name and description, choose its type and set its Starting value:
| Type | Example | Use it for |
|---|---|---|
| True / false | Power restored starts False. | A fact that is either true or false. |
| Number | Supplies remaining starts 3. | A quantity or threshold; compare it with ==, !=, <, >, <= or >=. |
| Text | Entered password starts empty. | An exact written value; use matching text and check its spelling/case. |
The engine creates each flag before the game's startup script, which can still override it. Friendly names appear in rules, NPC conversation topic conditions, Objectives and Smart Prose. Raw script flags remain supported. Story states are shared game facts; use an NPC's private memory or a script's local values when that information belongs only to that character or call.
The script key is stable. Rename the friendly name without breaking references. Where used lists structured references and matching script/text references. Deletion and type changes are blocked while references are found. Dynamic script-built names cannot always be resolved; review scripts before removing a state. State IDs are deliberately not a second rename mechanism.
Imported projects can keep their Story configuration in a protected source payload. The Story tab shows that source and its decoded definitions for inspection, and pauses visual authoring so a second configuration cannot overwrite or conflict with it. Objectives share this authority. Keep an editable backup before moving protected definitions into a reviewed visual configuration. Projects with competing configurations report the conflict and retain both for repair; visiting the editor does not convert them automatically.
A rule contains:
- When: game start, turn end, a supported room/object/NPC event, or a call from another rule. Select the real Trigger target and Event for an entity event. A rule set to Called by another rule does not run by itself; invoke it with Run shared rule from a native action list.
- If: choose All must pass or Any may pass, then add comparisons. You can check managed states, carried objects, the current room, configured NPC facts, Quest progress and scene activity. The available value controls follow the selected type. With no conditions the rule is eligible under either match setting.
- Then — in this order: add ordered actions. These can show text, set a state, change score/money, give/move/hide/reveal an object, move an NPC/player, run a typed script/shared rule, operate supported native features, end the game or stop this rule. Set story state assigns the chosen value; use an authored script when you need a calculation rather than a fixed value. Bind required inputs for a typed script call. NPC ability/control actions require a configured capability profile; see the NPC guide.
- Otherwise: text shown when requirements fail.
Ordinary event scripts run first, followed by matching enabled rules in list order. Move actions/rules up or down to control order. A Run once rule marks itself completed after its requirements pass and before its actions execute. That includes reaching Stop this rule. A failed requirement does not consume the rule. A disabled shared rule does nothing. Shared-rule cycles are rejected; script nesting retains the existing depth limit.
Deleting a shared rule checks its native callers, including mechanic actions. The refusal names dependent definitions or source paths. Rebind or remove those calls before deleting the rule; a rule used elsewhere must not become a missing dependency during a normal delete.
The native Stop this rule action ends the remaining actions of the current rule. Earlier changes remain, and a Run once rule has already been consumed. In advanced TAML, STOP exits the current enclosing script, including when it appears inside an IF or loop. A script that called that script continues after the call. Neither operation ends the game; use the explicit End game action for that outcome.
Enabled determines whether a rule can run. Run once after requirements pass prevents repeated rewards from that rule; once it has run, later matching events skip it rather than displaying Otherwise. Put every success requirement in If, and place a reward after the actions that establish success. A once-only checkbox is not proof that an advanced script or an actual handover succeeded. For accepted delivery, repair or rescue, connect the relevant native interaction and its verified result.
Turn end runs when the engine advances a game turn. It does not mean every keypress, every menu click or elapsed real time. Command timing and journal settings can affect whether an action spends a turn. Start fresh and test the same player commands when a rule controls a deadline or hazard.
Choose Mobile in NPC Setup before a rule moves that NPC. Missing references, wrong value types, and unsupported configurations block Save, Play, Test Lab, and Export. Fix the named reference before continuing. Rules use existing engine semantics; a built-in interaction may have its normal effects before an event handler runs. This is not a universal intercept/prevent-action system.
Save/reopen preserves the definitions. In managed-rule games, SAVE/LOAD/UNDO preserve the rule flags, NPC locations/alive status, and conversation state alongside existing object/visibility state. Restart in Test Lab creates a fresh engine from the project's starting state.
Build a first rule: repair a switch once
This small exercise needs one room and two ordinary objects. Save your current project first if you want to start a separate practice project.
- Create a starting room called Workshop, an object called switch placed there, and a takeable object called wrench placed there. The switch can remain fixed. Enable Score in World → Game Setup → 8. Player Features if you want the points displayed.
- In Gameplay → Story & rules, choose Add story state. Name it Power restored, choose True / false, and set its Starting value to False. Keep its generated script key.
- Choose Add rule and name it Repair the switch. Keep Enabled checked and check Run once after requirements pass.
- Under When, select Object event, choose the switch as Trigger target, and choose use.
- Under If, keep All must pass. Add a carried-object condition requiring the wrench to be carried. Add a state condition requiring Power restored to equal False.
- Under Then — in this order, set Power restored to True, show the message The switch is repaired., and add 5 score. Under Otherwise, write Carry the wrench before repairing the switch.
- Save the editable project and open Test → Test Lab → Start fresh test. Run the commands below. Inspect the actual state and score; do not infer success from the message alone.
| Command | Expected result |
|---|---|
use switch |
The requirement fails. Power restored stays False and score stays 0. The Otherwise text appears. |
take wrench |
The player actually carries the wrench. |
save |
A player checkpoint records the state before repair. |
use switch |
Power restored becomes True, the success message appears and score becomes 5. The wrench remains carried. |
use switch again |
The once-only rule adds no further points. |
load |
Power restored and score return to the saved pre-repair values. |
use switch, then undo |
The successful repair can be undone; the state and score return to their pre-command values. |
Restart to repeat the failed and successful attempts from the beginning. Save and reopen the editable .tagm to verify its definitions. Export a fresh Light Web Player and repeat the route there. Player SAVE/LOAD/UNDO change the running game's state; they are separate from creator project recovery and editing history.
Check a rule that does not behave as expected
- Confirm Enabled, the trigger kind, the exact target and the event. Opening or examining an object does not fire a rule configured for Use.
- Inspect the current state values and required carried items. Check All must pass versus Any may pass, value types and exact text. Conditions do not create an item, repair, acceptance or safe arrival automatically.
- Review earlier event scripts and earlier rules; they can change facts before a later rule checks them. Put actions in the intended order and avoid competing rewards in several handlers.
- Remember that a successful Run once rule stays spent for the current game until a suitable Undo/Load or a fresh restart restores earlier state. Start a fresh Test Lab session after changing definitions; an already running session retains the definitions it started with.
- Repair missing-reference or type errors shown by the creator. Use Where used before deleting a state, and review dynamic script references yourself.
Test Lab: record and replay
Choose Test Lab guide for the dedicated saved test evidence and problem reports guide. It explains current/stale/never-tested receipts, Replay all routes, expectation review and diagnostic preview/download choices.
Choose Start fresh test to start the current project with isolated in-memory save slots. Type commands or numeric conversation choices. Test Lab never writes player save slots.
To create a repeatable test route:
- Give it a name and choose Record from restart.
- Play the sequence, including numeric conversation choices, SAVE/LOAD, UNDO, or RESTART if required.
- Choose Save recording, review Edit expectations, and save the project.
- Select the saved route and choose Replay selected route.
The recorder captures expected room, inventory presence/absence, scalar flags (including objective flags), score, and ending after each completed command. These are observations, not proof the observed behavior is correct: review them against your intended design. You can edit/add/remove checks deliberately. Expected score does not prove the game's theoretical maximum score.
Draft recordings are kept in project memory after every completed command, and in the project file when you save it. Switching creator tabs preserves the live session. Reopening a saved unfinished route retains its completed steps as a draft; review and apply expectations to finalize it, or record a new route. A paused unfinished command is not recorded as complete.
Each replay starts fresh with empty isolated save slots. It records build identity, source fingerprint, restart origin, and the current deterministic runtime policy. The current engine also supports native seeded outcome tables and prose variation; use the same seed and command order when testing those systems. External or nondeterministic extensions are not made repeatable by recording a route. See controlled randomness and language authoring.
A mismatch stops replay at the first failing step and shows expected/actual values, before/after state, and a trace. Later steps are NOT TESTED. A step with no assertions, an unfinished route, or an empty route is NOT TESTED, never PASS. Source changes do not overwrite old expectations. Missing object, room, or asserted-flag targets fail explicitly; a deleted object cannot pass a check merely because it is no longer in inventory. A recorded RESTART paused during startup is captured only after startup finishes. Use Download route for its definition. Preview replay report opens a bounded diagnostic preview; inspect it before choosing Download problem report. Actual replays also keep a compact latest run receipt in the project. Its current/stale status compares the tested source, executable route definition and replay-tool contract; a recording fingerprint alone does not establish PASS.
Visual debugger
Enable explanations in Test Lab. Each command shows its before/after state; supported TAML actions show their source, nesting, conditions, and state changes. View rule or View source opens the corresponding details. Visibility and equipped items are included in snapshots. Source details retain the definitions used by that running test or replay; a notice asks you to start fresh after editing game definitions. Legacy script/entity identity is retained; generated sources are identified as such.
Use Pause before rule or Pause after state change. The engine suspends the actual command, not a retrospective animation. Player input is disabled while paused. Step into next action advances to the next supported statement boundary, entering nested scripts. Continue runs to the next chosen breakpoint or completion. Turn-end effects run only when execution reaches them. Restart discards the paused command and creates a fresh engine.
State-change breakpoints cover explicit state assignment statements, including managed Set state actions and legacy set. Built-in command internals are summarized by snapshots rather than individually stepped. Traces are limited to 2,000 entries per command and explicitly report truncation. Normal player exports have no debugger UI and tracing is off.
Inspect the complete Story States & Rules workshop
Visit Sample Projects on the website and find Getting Started → Story States & Rules Workshop. Download the editable .tagm, save current work and open it with Open Existing or Open Project to inspect its two-room native game. Play Example runs its Light player and View Walkthrough opens this guide. You can also play the workshop or download its editable project. Save current work before opening the downloaded project.
Inspect the sample's Power restored, Prisoner rescued, numeric rescue count and text password states. The lever's Use rule changes power. Opening the cage requires both that power and the actual carried key; its once-only rule moves the guide, records rescue and gives 100 points. Entering the yard ends the game only after rescue. These connected rules demonstrate that a completion message alone is insufficient.
The main route is search, take key, use lever, open cage, north. Try open cage before finding the key or restoring power, and repeat it after success to check that the reward stays at 100. SAVE before rescue, then LOAD or UNDO to inspect the restored state and repeat the accepted rescue. The supplied route definitions are available for replay in Test Lab.
Check your own project
Use the sample's success, failed-requirement and repeat-reward commands as a pattern for your own Test Lab routes. Review their expected results after adapting the entities or rules. Check the editor, the saved/reopened project, a fresh standalone HTML export and the live Community player separately.
Newer managed features can require a compatible editor. If an older editor refuses the project, keep your original .tagm rather than removing its capability information. Configure your currency wording explicitly and check it during play.
See the feature overview and quests, scenes, hints and languages guide for related tools.
Download editable projectPlay Example (new tab)All Sample Projects