Incorporating Standalone Code into MUD client

by Trakis

Back to Mechanic's Corner.

Trakis2008-10-10 16:59:38
I wrote some code that I run in the Python interpreter that is basically the bare bones of a curing system.

The code is basically a command prompt that lets me enter in things like +anorexia and +web, which add the afflictions to a list. Then, I can remove them with commands like -anorexia, etc.

The idea is to eventually allow it to run in the background, having a MUD client send the +aff commands from affliction messages. It would then obviously send the commands to cure, and would receive the -aff commands from the MUD client when the unaffliction messages are received.

I was thinking I would build it as a standalone program with wxWidgets, and let a mud client communicate with it like the way things are done in Avator's Building GUI components for MUSHclient posts that are stickied here, but I don't want to tie myself to MUSHclient/Windows. I would actually like to allow it to work with a platform independent client, like TinyFugue.

Do any of you have a good idea for how this can be implemented?
Charune2008-10-10 17:08:29
Though I'm not sure offhand how to directly do this, I do know TinyFugue already has a Python patch. It's at http://sizer99.com/tf/. You should then be able to write normal alias hooks (/def -h"^SEND thing" blah=\\etc) where thing is your +whatever.
Trakis2008-10-10 17:13:17
Thanks. I took a look at that, but the hooks usually let you run a snippet of Python code when you call an alias, or activate a trigger. I'm not sure how it'd work with what I have in mind, though, because it's more or less an infinite loop that accepts input. Maybe this can be done with threading, but honestly I don't understand threading at all.

I mean, I could bind the code to an alias called "startCuring", which starts up the loop, but I'm not too sure how I'd send commands to it.
Charune2008-10-10 17:42:12
QUOTE(Trakis @ Oct 10 2008, 01:13 PM) 569150
Thanks. I took a look at that, but the hooks usually let you run a snippet of Python code when you call an alias, or activate a trigger. I'm not sure how it'd work with what I have in mind, though, because it's more or less an infinite loop that accepts input. Maybe this can be done with threading, but honestly I don't understand threading at all.

I mean, I could bind the code to an alias called "startCuring", which starts up the loop, but I'm not too sure how I'd send commands to it.

You could just make a send hook on anything and parse it inside.
Trakis2008-10-10 18:33:42
I will try that. Thanks.
Unknown2008-10-12 23:41:02
It's not for the novice user, but you could build your Python app to accept (or make) UDP connections and then communicate with something like MUSHclient (or TF, probably) using plugins. There are threads floating around here about how someone used UDP to build an external GUI for MUSHclient and communicate back and forth using a plugin.

If you don't mind learning Lua, you could always code your base curing stuff for MudBot and use that as a generalized, client-neutral platform.