Example 3 · Lua plugin
A notes popup plugin for grandMA3, built by asking
Press the plugin and a notepad pops up on the console, saved with the show. We didn't write it. We asked Claude for it, and you can download it below.
I want to create a notes popup plugin that lets you write notes in MA3 and that has it stored. Put it in spot 12.
It checked the console before writing anything
Claude read the Lua docs and the API, then ran small probe plugins on the console to see which text fields MA3 actually has:
TextEdit=true EditBox=false
It wrote the plugin, installed it in Plugin 12 and ran a self-test. The test passed.
We found a bug, it found the cause
When we opened the window, the text field wouldn't take clicks. We told it so, and it probed the field's properties on the console:
TextEdit Focus=Never LineEdit Focus=WantsFocus
MA3's multi-line field ignores focus by default, so it set
Focus = "InitialFocus". The same probe showed that the field has
no text-changed event either, so the autosave had never run. It now saves
once a second while the window is open. We asked for some padding around the
text, and the plugin worked. From the first message to a working notepad took
under ten minutes.
That's the pattern for plugins: GrandPA lets the AI run code on the console and read what really happened, and you try it on screen and say what's wrong.
Download the grandMA3 Notes plugin
- Put both files in
gma3_library/datapools/plugins. - Edit an empty slot in the Plugins pool, choose Import
and pick
Notes.xml. - Press the plugin, or type
Plugin "Notes".
How it works
- The notes are stored in the show file, in a global variable called
NotesPlugin_Text, so they travel with the show. Save the show to keep them on disk. - The text saves every second while the window is open, and on Save & Close. Closing with Escape or the X keeps it too.
- Clear asks before deleting anything.
Plugin "Notes" "clear"wipes the notes from the command line.
It's about a hundred lines of plain Lua, so it's a reasonable starting point if you want to build your own popup.
More examples
Build your own plugin
The trial includes 100 free writes, and reads are always free.
Download GrandPA