Been reading up on COM objects and trying to figure out a reasonable way to do something to integrate with MUSHClient. The following is a general concept I developed:
The '0' are COM interfaces. Basically Each plugin has the basic set of COM interfaces, but also a requirement that designers include ObjectName.Setup interface which passes the plugin code in the program a list of available commands, their inputs/outputs and any other info needed to add menu items, client interfaces, configuration and help files.
So.. You could then from in MUSHclient access the help for that plugin or send calls to it by sending the appropriate commands to the menu program. Current possibilities for plugins are:
Item database
A real mapper
My spell icon concept
A renderer (Produces a 3D pic from a text file or through
FTP to a server).
As in Render.Generate ("FTP", "ftp://ftp.someplace.com/file.sdl") or
Render.Generate ("Stream", "data from the mud").
So for instance if you used an alias to cast a spell it would call a script with something like:
Menusvr.command("SPIcon","Myworld","MySpell","Activate")
and then a trigger matching on the spell ending would call:
Menusvr.command("SPIcon","Myworld","MySpell","Terminate")
The menu itself would check to make sure a SPIcon plugin was loaded and that 'Activate' and 'Terminate' where valid command (from the setup) and call the linked COM interfaces to make it happen. One useful thing about this is you can add a Menusvr.Focus("Myworld") command that would automatically switch to or open/close windows plugins being used by each world by calling a 'hide' command in active ones and 'focus' in those that match the world. Along with the 'setup' command, these would be 'required' interfaces in the plugins, with predictable behaviors.
As for the mapper.. One obvious problem with them is exits that don't enter the same way they left and special commands. The special exit one is note easy to solve, but a drag-and-drop that let you 'merge' rooms where the exits are not the strict reverse of the entry would be fairly simple. Built in to a client you can use available exits and room descriptions to make a better match, but... 'if' I do make a mapper it will likely be a major challange to feed the built in mapping data to an external program to 'map' exits in only one direction (and hope that the correct exit is also the opposite one when headed back). For something like this though, it is a real problem, since merging a room is easy, but 'splitting' a bad one correctly...:
Room1
Some stuff.
Exits north and west.
north
Room2
Other stuff.
Exits south and east.
south
Room3 <-oops!
Some more stuff.
Exits north and southwest.
Similar complications would be true for an item database, since you would have to manual add them or trigger/script for only when you go to the shop to price them or something. It would also tend to be a lot more variable across worlds. :p
In any case I 'think' I can figure out how to make most of this work, but.. I need the basic menu bar program to load when you call it from MUSHClient, but be able to 'stay' loaded. The problem is that COM assumes that once the client is done talking to something it should release the object. :p A non-COM interface would be a pain and using an intermediary to run the menu doesn't work very well, since it has no real way to know if the program has actually loaded. This causes problems between Moray and POVRay, which use such an interface. I am also not entirely sure who to use a COM to talk 'between' two stand alone programs.
Making the menu itself a COM object would be best, but then it isn't loadable (It would be an EXE, but...??) without MUSHclient running and I am uncertain how MUSHclient releases COM objects (when the connection closes or you close the world?) To get around this I need a way to keep the menu running even if MUSHclinet dies completely. So... Can a COM server be it's own 'client'? If so then it could keep itself open until you shut it down from the menu itself. If not, then I have a major problem.
This is very confusing. lol
It would be much easier if I didn't have to worry about having the system shut down the server object unexpectedly because it thinks it isn't needed anymore, but COM isn't intended for 'persistant' execution. :p
Of course... It would be a lot easier if this was intergrated into MUSHclient, especially since I wouldn't need to code it then. Hint, hint. ;) (And those of you who think it is a good idea might actually see it happen eventually. lol)
_________________________________________
[Menu bar_________________________________]
| |
| |\-o- Plugin 1
| |\-o- Plugin 2
0 - Link to MUSH. \--o- ...
|
|
|
Mushclient
The '0' are COM interfaces. Basically Each plugin has the basic set of COM interfaces, but also a requirement that designers include ObjectName.Setup interface which passes the plugin code in the program a list of available commands, their inputs/outputs and any other info needed to add menu items, client interfaces, configuration and help files.
So.. You could then from in MUSHclient access the help for that plugin or send calls to it by sending the appropriate commands to the menu program. Current possibilities for plugins are:
Item database
A real mapper
My spell icon concept
A renderer (Produces a 3D pic from a text file or through
FTP to a server).
As in Render.Generate ("FTP", "ftp://ftp.someplace.com/file.sdl") or
Render.Generate ("Stream", "data from the mud").
So for instance if you used an alias to cast a spell it would call a script with something like:
Menusvr.command("SPIcon","Myworld","MySpell","Activate")
and then a trigger matching on the spell ending would call:
Menusvr.command("SPIcon","Myworld","MySpell","Terminate")
The menu itself would check to make sure a SPIcon plugin was loaded and that 'Activate' and 'Terminate' where valid command (from the setup) and call the linked COM interfaces to make it happen. One useful thing about this is you can add a Menusvr.Focus("Myworld") command that would automatically switch to or open/close windows plugins being used by each world by calling a 'hide' command in active ones and 'focus' in those that match the world. Along with the 'setup' command, these would be 'required' interfaces in the plugins, with predictable behaviors.
As for the mapper.. One obvious problem with them is exits that don't enter the same way they left and special commands. The special exit one is note easy to solve, but a drag-and-drop that let you 'merge' rooms where the exits are not the strict reverse of the entry would be fairly simple. Built in to a client you can use available exits and room descriptions to make a better match, but... 'if' I do make a mapper it will likely be a major challange to feed the built in mapping data to an external program to 'map' exits in only one direction (and hope that the correct exit is also the opposite one when headed back). For something like this though, it is a real problem, since merging a room is easy, but 'splitting' a bad one correctly...:
Room1
Some stuff.
Exits north and west.
north
Room2
Other stuff.
Exits south and east.
south
Room3 <-oops!
Some more stuff.
Exits north and southwest.
Similar complications would be true for an item database, since you would have to manual add them or trigger/script for only when you go to the shop to price them or something. It would also tend to be a lot more variable across worlds. :p
In any case I 'think' I can figure out how to make most of this work, but.. I need the basic menu bar program to load when you call it from MUSHClient, but be able to 'stay' loaded. The problem is that COM assumes that once the client is done talking to something it should release the object. :p A non-COM interface would be a pain and using an intermediary to run the menu doesn't work very well, since it has no real way to know if the program has actually loaded. This causes problems between Moray and POVRay, which use such an interface. I am also not entirely sure who to use a COM to talk 'between' two stand alone programs.
Making the menu itself a COM object would be best, but then it isn't loadable (It would be an EXE, but...??) without MUSHclient running and I am uncertain how MUSHclient releases COM objects (when the connection closes or you close the world?) To get around this I need a way to keep the menu running even if MUSHclinet dies completely. So... Can a COM server be it's own 'client'? If so then it could keep itself open until you shut it down from the menu itself. If not, then I have a major problem.
This is very confusing. lol
It would be much easier if I didn't have to worry about having the system shut down the server object unexpectedly because it thinks it isn't needed anymore, but COM isn't intended for 'persistant' execution. :p
Of course... It would be a lot easier if this was intergrated into MUSHclient, especially since I wouldn't need to code it then. Hint, hint. ;) (And those of you who think it is a good idea might actually see it happen eventually. lol)