Thanks man that looks cool, will be nice when you share the code
I haven't released it yet but I plan to soon, so here's the source
I've been considering making something similar but I took the easy route of using the decorator namespace like LeFix suggested. Can you explain the general architecture? I thought of making a library that could act as layer between mods, so everybody could compile against the lib to have access to it like with SHV. It does create a dependency to the new lib for mods though and they'd have to include a (possibly outdated) distribution or link to some external resource. Both aren't optimal. And I know if I make something, I'm definitely going to hate it some time later when I find a bug and need to update something like that.
I haven't documented my source well (yet ), but basically:
I use the EventWaitHandle class to create system events. Each event name should match an accompanying *.scmod file in the scripts folder, which should be provided by the script that wants to appear on the menu (see the Example project).
The Script Communicator Menu will search for all the *.scmod files in the scripts folder and add them to the menu, each with their own EventWaitHandle object. When an item in the menu is selected, the event will be signaled/triggered, and the script that receives the event will execute whatever block of code they want.
This should also work with C++ scripts! The menu only searches the scripts folder though, so maybe I should change that..
I've included a simple helper class that makes it a bit easier to use in C#, should be easily translated?
For users that want to use it to trigger their own menus, I've included an option to block the Script Comm. menu from triggering (ex: while another menu is open) until the script unblocks it. Though, if a script blocks it and never unblocks it, general users would think it's the fault of the Script Comm. menu rather than the creator of the other script lol
I don't really know the limitations of this method. Maybe it won't work at all on non-admin/limited user accounts.
Also, there is no actual "communicating" in terms of sharing variables and whatnot, just event signaling really
But the one pro I like about it is that any script that wants to use this does not need to reference anything, it just needs to supply the *.scmod file(s) and wait for the event(s) to trigger, and the ScriptCommunicatorMenu handles the rest.
Sorry if I did not explain it well!