insert_event_commands
Insert validated event-command fragments into map events, common events, or troop pages. Validates boundaries/references; refuses invalid writes; supports dry-run and atomic backups.
Instructions
Insert a complete event-command fragment into a map event page, common event, or troop battle page. Validates the fragment, insertion boundary, resulting list, and supported references before writing. Invalid data refuses the write. Omit position to append before the root end marker; an explicit position must be a safe command boundary (not inside a text continuation or between a block header and its branches). Fragments are rebased to the target indentation. dryRun:true validates and previews without writing or creating backups. Normal writes use the existing atomic backup-protected project writer. Returns target identity, insertion count, the resulting list length and its command codes (listCodes), and warnings; pass verbose:true to also get the full before/after lists. Existing unknown extension commands are advisory; known MZ-only commands are rejected.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mapId | No | map_event target map ID. | |
| dryRun | No | Preview the validated change without writing. Default false. | |
| target | No | Defaults to map_event. | |
| eventId | No | map_event target event ID. | |
| troopId | No | troop_page target troop ID. | |
| verbose | No | Include the full before/after command lists in the result. Default false. | |
| commands | Yes | A complete fragment, typically returned by build_event_commands. A supplied final root terminator is normalized; the target always retains exactly one. | |
| position | No | Zero-based insertion index in the existing command list. Out-of-range or unsafe boundaries are rejected. | |
| pageIndex | No | map_event/troop_page: zero-based page, default 0. | |
| commonEventId | No | common_event target ID. |