Adding Macros (editor scripts)

A macro would be a script running in the editor. It would allow to manipulate the project file programmatically on specific events. Some examples of how that could be used:

  • creating and linking a text to a button sprite when one is placed
  • automatically move an object in relation to the position of another object
  • insert some template events when a comment saying "insert template " is made
  • auto optimize some events
  • scan strings to enable translations files to be generated
  • auto-generate complicated structures with objects (like generating a maze out of wall objects)

And many more usages!
For a beginning just enabling loading of Javascript scripts with an init function and an update function being called once every idk 200 ms with access to the GD.Project instance would be enough to do all of that at least in a hacky way. The next step would be adding many event handlers to only trigger code when needed, possiblity to add stuff to the graphical interface (for example add options to the context menu, add items to the menubar) and ultimately even make some sort of event sheet based macro editor (this would be way more difficult as it would require basically a whole platform by itself).

2 Likes