Expand description
amble_script – authoring-focused DSL, parser, and compiler for building
Amble worlds.
The crate powers the amble_script CLI but is fully usable as a library.
Major capabilities:
- Parse and lint
.amblesources for rooms, items, triggers, spinners, NPCs, and goals, catching unresolved references early. - Compile the DSL into structured TOML that the
amble_enginecrate consumes. - Provide AST types so tooling can analyze or transform worlds before serialization.
ⓘ
use amble_script::{parse_rooms, compile_rooms_to_toml};
let src = r#"
room foyer {
name "Foyer"
desc "An inviting entryway."
}
"#;
let rooms = parse_rooms(src).expect("valid DSL");
let toml = compile_rooms_to_toml(&rooms).expect("compiles");
println!("{toml}");For a full language tour see amble_script/docs/dsl_creator_handbook.md in
the repository.
Structs§
- Action
Stmt - Top-level action statement with optional priority metadata.
- Consumable
Ast - Consumable configuration attached to an item.
- ExitAst
- Connection between rooms emitted within a room AST.
- GoalAst
- High-level representation of a single goal definition in the DSL.
- Item
Ability Ast - Single item ability entry declared within an item.
- ItemAst
- AST node describing an item definition.
- Item
Patch Ast - Data patch applied to an item when executing a
modify itemaction. - NpcAst
- AST node describing an NPC definition.
- NpcDialogue
Patch Ast - NPC dialogue line update used inside a
modify npcaction. - NpcMovement
Ast - Movement configuration emitted for NPCs.
- NpcMovement
Patch Ast - Movement configuration updates for an NPC.
- NpcPatch
Ast - Data patch applied to an NPC when executing a
modify npcaction. - Overlay
Ast - Conditional overlay text applied to a room.
- RoomAst
- Minimal AST for a room definition. AST node describing a compiled room definition.
- Room
Exit Patch Ast - Exit data emitted inside a
modify roomaction patch. - Room
Patch Ast - Data patch applied to a room when executing a
modify roomaction. - Spinner
Ast - Spinner definition containing weighted text wedges.
- Spinner
Wedge Ast - Individual wedge (value + weight) inside a spinner.
- Trigger
Ast - A minimal AST for a single trigger.
Enums§
- Action
Ast - Minimal action variants.
- AstError
- Errors that can happen when parsing the DSL input.
- Compile
Error - Errors that can occur while compiling the AST to TOML.
- Condition
Ast - Trigger condition variants.
- Consumable
When Ast - Behavior when a consumable item is depleted.
- Container
State Ast - Container states expressible in the DSL.
- Goal
Cond Ast - Conditions that can activate, complete, or fail a goal.
- Goal
Group Ast - Logical grouping for goals used when rendering score breakdowns.
- Ingest
Mode Ast - Ingestion modes supported by the DSL; mirrors engine
IngestMode. - Item
Location Ast - Possible item locations in the DSL.
- NpcLocation
Ast - Location specifier used for NPC placement.
- NpcMovement
Type Ast - Movement types supported for NPC definitions.
- NpcState
Value - NPC state reference used in overlays and patches.
- NpcTiming
Patch Ast - Movement timing update for an NPC.
- OnFalse
Ast - Policy to apply when a scheduled condition evaluates to false at fire time.
- Overlay
Cond Ast - Overlay predicate used when computing room description variants.
Functions§
- compile_
goals_ to_ toml - Compile goals into TOML string matching amble_engine/data/goals.toml structure.
- compile_
items_ to_ toml - Compile items into TOML string matching amble_engine/data/items.toml structure.
- compile_
npcs_ to_ toml - Compile NPCs into TOML string matching amble_engine/data/npcs.toml structure.
- compile_
rooms_ to_ toml - Compile rooms into TOML string matching amble_engine/data/rooms.toml structure.
- compile_
spinners_ to_ toml - Compile spinners into TOML string matching amble_engine/data/spinners.toml structure.
- compile_
trigger_ to_ toml - Compile a
TriggerAstinto a TOML string representing one RawTrigger. - compile_
triggers_ to_ toml - Compile multiple triggers into a single TOML string with one
triggersarray. - parse_
goals - Parse only goal definitions from the given source.
- parse_
items - Parse only items from a source (helper/testing). Parse only item definitions from the given source.
- parse_
npcs - Parse only npcs from a source (helper/testing). Parse only NPC definitions from the given source.
- parse_
program - Parse multiple triggers from a full source file (triggers only view).
- parse_
program_ full - Parse a full program returning triggers, rooms, items, and spinners.
- parse_
rooms - Parse only rooms from a source (helper/testing). Parse only room definitions from the given source.
- parse_
spinners - Parse only spinners from a source (helper/testing). Parse only spinner definitions from the given source.
- parse_
trigger - Parse a single trigger source string; returns the first trigger found.