add_event_command
Add commands to RPG Maker event pages to control game logic, dialogue, and interactions within maps.
Instructions
Add a command to an event page
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mapId | Yes | ||
| eventId | Yes | ||
| pageIndex | Yes | ||
| command | Yes | ||
| position | No |
Implementation Reference
- src/tools/mapTools.ts:261-295 (handler)The implementation of the addEventCommand function which adds a command to an event page in an RPG Maker map.
export async function addEventCommand( projectPath: string, mapId: number, eventId: number, pageIndex: number, command: EventCommand, position?: number ): Promise<MapEvent> { const map = await getMap(projectPath, mapId); if (!map.events[eventId]) { throw new Error(`Event ${eventId} not found on map ${mapId}`); } const event = map.events[eventId]!; if (!event.pages[pageIndex]) { throw new Error(`Page ${pageIndex} not found on event ${eventId}`); } const commandList = event.pages[pageIndex].list; if (position !== undefined && position >= 0 && position < commandList.length - 1) { // Insert at specific position (before the end command) commandList.splice(position, 0, command); } else { // Add before the end command (code 0) commandList.splice(commandList.length - 1, 0, command); } const mapPath = getMapPath(projectPath, mapId); await writeJsonFile(mapPath, map); return event; } - src/index.ts:452-475 (registration)Registration of the add_event_command tool in the MCP tool list.
name: 'add_event_command', description: 'Add a command to an event page', inputSchema: { type: 'object', properties: { mapId: { type: 'number' }, eventId: { type: 'number' }, pageIndex: { type: 'number' }, command: { type: 'object', properties: { code: { type: 'number' }, indent: { type: 'number' }, parameters: { type: 'array' }, }, }, position: { type: 'number' }, }, required: ['mapId', 'eventId', 'pageIndex', 'command'], }, }, { name: 'create_map', description: 'Create a new map with specified dimensions and properties. Returns the new map ID and map data.',