>I think you could instantiate an external COM object,
>keeping its pointer in a global variable, use it when
>needed, and then release it at shutdown (eg. on world
>close script). That should all work OK.
Yes, but that is sort of the point. You can have client crashes (rare), script bugs that require reloading them, etc. All such things can terminate the COM server and lose track of where things are and what is happening. It can probably be worked around, but I would rather have it runnable using a call, but also stand alone. In the case of Moray and POVRay the COM link used can run POVRay from inside Moray, but generally it works poorly since the linking object is not really 'aware' of the other programs execution, so it can mistakenly believe it loaded and ready when it is not. There is no easy way to fix this. I suppose I could make it save a datafile with all info for the worlds being used so if something crops up it can 'reset' to a prior state, but it would be necessary to also force users to save the state info in the plugins or pass the needed data to the server as part of the shutdown process. It is unwieldy and prone to collisions where it is still busy trying to sort stuff out and the client starts talking to it again. I would rather have it loadable, but capable of being used offline and that looks to be a bit complicated.
The individual plugins are not a problem, it is keeping the server alive long enough to deal with any such accidents or for offline use. COM was not really intended to allow either.
>I could make a DLL interface, and have plug-ins, but why
>bother when this works?
Because there is no 'direct' way to pass some forms of data to an external program. A mapper for instance should recieve 1) the command that was sent, 2) A room description and 3) the exits for that room.
Item 1 can't be passed easilly from the client, though you can sort of fake it by pulling the data from the current mapping feature and feeding that into a program. The problem is you can't extend the set of commands recognized, so unless you alias every instance of nw, ne, sw, se, out, enter *, leave, climb, etc. you can't catch those that are not standard. It makes doing it right a nightmare.
Items 2 and 3 are nearly impossible to get. You can, but the irony here is that you can retrieve the non-standard ones really easy, but standard n, s, e, w, u, d are not 'caught' by aliases or other methods that can call scripts, so grabbing the room info can't be done for them.
Trying to do it externally is a mess and there are probably other cases where getting data from the client to the external COM object is a major pain. I see only two real advantages I see with my idea is that it can be linked to other programs, but since MUSHclient is the only Windows client that supports it.... which is a dubious recommendation for this method. The other benefit is that you don't take up space in the clients name space keeping track of the whole mess. This is helpful, but I am not sure it outways the limitation of trying to shoehorn some things in through the scripting.
Most things I agree can be done the way I intend. The mapper though is a pain to get right when built in, it will be a nightmare to make work the way MUSHclient handles directions and its own limited path caching.
Maybe an optional new script routine to go with the world.connect, etc., called world.OnCommand. It would execute each time a new command was sent to output and let you handle it directly. Currently there is no way to execute a script whenever a command is sent, so mapping like I want to do would be on a 1 second timer. You could move 3-4 rooms in some cases in the time it would take for the mapping script to even realize it had something to do. This precludes setting a trigger to grab the room text, as you would need in order to successfully run such a good mapper. It just isn't feasible as things stand. I had planned to cheat and just map the direction you moved and let the person go back and call a capture script to get exits and room description, but it is a silly way to do it. |