insert_event_commands
Insert pre-built event command sequences into map events, common events, or troop pages in RPG Maker MZ projects with validation before writing.
Instructions
Insert a pre-built sequence of event commands (from the build_* builders) into any of the three command lists an MZ project has — the mutating companion to the read-only builders. Splices before the list’s end marker (or at position). target "map_event" (the default) needs mapId + eventId + pageIndex; "common_event" needs commonEventId; "troop_page" needs troopId + pageIndex. The resulting list is validated before writing: a structural problem (wrong parameter count for a command code, a list left unterminated) refuses the write and saves nothing — pass force: true to override. Advisory findings (unrecognized code, over-long text line) are returned as warnings and never block. Returns { target, id, list, warnings? }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Write even if validation finds structural problems (wrong parameter count, unterminated command list). Off by default: such a write is refused and nothing is written. Advisory warnings never block regardless. | |
| mapId | No | target "map_event": the map id | |
| dryRun | No | Preview only: return a diff of what would change without writing to disk. | |
| target | No | Which command list to insert into (default map_event) | |
| eventId | No | target "map_event": the event id | |
| troopId | No | target "troop_page": the troop id | |
| commands | Yes | The event commands to insert (e.g. the `commands` from a build_* tool) | |
| position | No | Insertion index; defaults to the end of the list | |
| pageIndex | No | target "map_event"/"troop_page": zero-based page index | |
| commonEventId | No | target "common_event": the common event id |