How snwfke/markline works
Purpose and runtime
markline is a Lua library embedded into DCS missions to turn F10 map-marker text into command-line-style AI/mission commands. It is loaded through a Mission Editor DO SCRIPT FILE action, then consumed by mission Lua scripts. The repository’s implementation is concentrated in snwfke_markline.lua.
Entry points and public API
The script exposes a global/module API centered on mark.cli(), which creates a CLI instance. Mission authors register command callbacks such as cli:on("ping", handler). The same runtime automatically attaches to DCS marker events when the DCS world.addEventHandler API is available.
Paths:
• snwfke_markline.lua
• README.md
• USAGE.md
Command registration and schema boundary
Commands are declared through the CLI API rather than hard-coded mission behavior. Each registered command associates a command name with callback logic and, per the documentation, supports schemas/flags. This separates reusable parsing and validation machinery in the library from mission-specific AI actions in the consuming mission script.
Paths:
• snwfke_markline.lua
• USAGE.md
Marker-event ingestion
DCS is the external event source. The library registers an event handler with world.addEventHandler, receiving marker lifecycle events rather than requiring callers to build their own handler. The event layer must consistently handle marker creation, updates, and deletion, which is the main control boundary between DCS simulation state and markline command processing.
Paths:
• snwfke_markline.lua
• README.md
Parse, validate, and dispatch pipeline
The primary flow is:
1. A player creates or edits an F10 marker in DCS.
2. DCS delivers the marker event to markline’s registered handler.
3. Marker text is treated as CLI input and parsed into command/arguments/flags.
4. The command is matched against registered definitions and schema rules.
5. The associated callback receives command context and invokes DCS mission APIs, such as trigger.action.outText or AI-control APIs.
This pipeline keeps command interpretation inside markline while side effects remain in mission callbacks.
Paths:
• snwfke_markline.lua
• README.md
• USAGE.md
Mission integration boundary
markline is not a standalone executable or web service. Its deployment unit is the Lua script copied into a .miz mission and loaded at mission start. Mission code instantiates the CLI and defines command behavior; DCS provides the Lua runtime, marker UI, event system, and mission-action APIs.
Paths:
• snwfke_markline.lua
• README.md
Extensibility model
The intended extension point is command definition: add commands, schemas, and callbacks without modifying core parsing/event machinery. Changes to parser semantics or event behavior belong in the single library implementation; mission-level behavior belongs in the mission script that calls mark.cli().
Paths:
• snwfke_markline.lua
• USAGE.md
Main entry points: snwfke_markline.lua Marker event handler · USAGE.md Usage documentation
Components 12
DCS Mission Runtime
- F10 map markers · Players create or edit command text.
- DCS event system · Delivers marker lifecycle events.
- Mission and AI APIs · Receives mission callback side effects.
markline Library
- markline runtime · Embedded library and public global API.
snwfke_markline.lua - Marker event handler · Registers through world.addEventHandler when available.
snwfke_markline.lua - CLI parser · Converts marker text into commands, arguments, and flags.
snwfke_markline.lua - Command registry · Matches commands and applies definition schemas.
snwfke_markline.lua - mark.cli() API · Creates CLI instances for command registration.
snwfke_markline.lua
Mission Extension
- Mission Lua script · Defines mission-specific command behavior.
- Command callbacks · Registered with cli:on(name, handler).
- Mission .miz package · Loads the library at mission start via DO SCRIPT FILE.
Other components
- Usage documentation · Describes loading, command schemas, flags, and callbacks.
USAGE.md
Connections 14
- Mission .miz package → markline runtime: loads · Mission Editor DO SCRIPT FILE action.
- Mission Lua script → mark.cli() API: creates CLI
- mark.cli() API → Command registry: owns definitions
- Mission Lua script → Command callbacks: registers
- Command callbacks → Command registry: adds commands and schemas
- markline runtime → Marker event handler: initializes
- Marker event handler → DCS event system: registers with · Uses world.addEventHandler.
- F10 map markers → DCS event system: creates marker events
- DCS event system → Marker event handler: delivers create, update, delete
- Marker event handler → CLI parser: passes marker text
- CLI parser → Command registry: command and arguments
- Command registry → Command callbacks: dispatches validated context
- Command callbacks → Mission and AI APIs: invokes AI or mission actions
- Usage documentation → Mission Lua script: guides integration