Commands

Plugin Commands

RPGReact currently exposes two commands in RPG Maker MZ’s Plugin Manager.

Commands

  • Show React App (show)

    • Displays the React overlay.

  • Hide React App (hide)

    • Hides the React overlay.

Usage example

  • Event → Plugin Command → RPGReact → Show React App

Sending data/events to React

  • For custom logic inside MZ overrides: use the injected event(eventType, eventSpecifier, data?, trace?) helper available within files under js/plugins/rpgreact/. This automatically passes platform/app context to React. See Plugin → Custom Overrides and UI → Event Reference for real examples already used by the stock overrides.

  • From Script calls (outside overrides): you can use RPGBridge.CreateEvent(type, spec, data?, trace?) after RPGBridge.IsInitialized() returns true.

From MZ (Script command) → React (outside overrides)

  • Use the bridge helper exposed by the UI: RPGBridge.CreateEvent(type, spec, data?, trace?).

  • Example Script command:

// Ensure the React UI has initialized first (e.g., call Show React App)
if (window.RPGBridge && RPGBridge.IsInitialized()) {
  // Use enums defined in menus/shared/types.js (emitted by the menus build)
  // Example: open the Main Menu screen
  RPGBridge.CreateEvent(
    RPGEventType.SCREEN_OPEN,
    RPGScreen[RPGScreen.MainMenu],
    { abitraryData: 'value' },
    'EventTrace_usedForDebuggingAndLoggingPurposes'
  );
}

From React → MZ

  • Register handlers inside the React app using RPGBridge.AddEventHandler({ id, handler }) and remove with RPGBridge.RemoveEventHandlerById(id).

  • See React UI → Messaging Bridge for full examples.

Notes

  • The overlay starts hidden until you call Show, or until your game logic raises an event that shows it.

  • Many runtime events are already emitted by the override files under js/plugins/rpgreact/ (scenes, battle, menu). Inside overrides, prefer the provided event(...) helper so platform context is included automatically. From Scripts, use RPGBridge.CreateEvent(...) when you need to emit custom events.

  • See React UI → Messaging Bridge and UI → Event Reference for examples that map to actual events in the stock overrides.

Last updated