Umm.. That is an interesting solution, but kind of pointless. There are already ways, including using callplugin from the external application, to achieve that, if you can code the application yourself. The problem has always been using applications or DLLs that you have not developed yourself, so are unable, or where it is impractical, to redesign the interface to talk to Mushclient indirectly. This is just another indirect solution that doesn't deal with the real problem. You may be correct in that using the events won't work, but if so, another hack which requires extra coding on the part of someone that may not have access to the code isn't going to fix it.
Now, Lua, Python, etc. all have code that reads the library data from ActiveX components and uses that (in the case of lua, through 'connect') to create an event handler. The code and the handler basically do this:
1. Pass handle of object to handler code.
2. Read objects interface table for list of events.
3. Listen for events.
4. When event fires, call the function linked to this event.
Lua's method gets a little different, since it uses <event_handler>:<event_name> to define the function, then calls that when the event happens. I think that this may be because Lua creates event handlers internally for each even at the creation of the object, so when you create one of your own, you are basically overriding the default code (which doesn't do anything). Others simply connect (when they can) to the any function you tell it too, others will simply check for a function called event_<event-name>. So if you had an event called scream, it would automatically assume the script has a function called event_scream, then call that if it exists. Frankly, the methods that link a function of a given name to an event are better, since the function can verify the function exists before hand.
Anyway, point is that real event handler are better than trying to find some way to do an end run around the existing feature, just because you think it won't work. Trying to add an event to a script, even if the event handler had to be in Mushclient, is trivial. It only requires the person writing the script to look up the information for the program or dll they are trying to use. By comparison, trying to glue together a program that sits in between and translates it into callplugin commands or UDP packets is *not* that easy. It requires that they basically re-impliment the entire interface for the program or object using what amounts to digital duct tape.
Frankly imho, this relatively minor annoyance is starting to take on Rube Goldberg proportions. |