On Fri, Jul 22, 2011 at 6:20 PM, Jonathan Gardner <jgard...@jonathangardner.net> wrote: > I had this idea on an easy way to write a MUD console. > > Basically, you start a program written in Python. This will connect to > the MUD of your choice, and otherwise behave like Telnet. In fact, it > will just spawn telnet to do all the hard work for you.
The "hard work" as you call it is simply: Open socket connection (possibly a DNS lookup), and parse some fairly simple TELNET codes (stuff like "go into password mode"). > As you type commands, they are piped directly into the telnet process > as MUD input commands. Commands that start with ! or maybe # will be > intercepted, however, and interpreted as special commands > > Also, as output comes back, you can put hooks in to react to the data > and execute Python functions, or pipe the data to subprocesses you may > spawn. For instance, you might spawn a subprocess that opens up a > window to show your current map location. When the MUD sends the map, > it is intercepted and directed to this map subprocess. Your status > line could be interpreted and displayed in another window in graphical > format. Yep, these sorts of ideas are fine. And will work just as easily when you do the socket connection yourself. In the early days of Android, my brother couldn't find a decent MUD client, so I whipped one up for him in Python. The project never went very far, but it's a start. It works on Linux, not Windows; but since you're referring to /usr/bin/telnet I assume that's not going to be a problem for you! Rather than attach it to this post, I've tossed the script onto my MUD's web site. (Yes, I run a MUD. Your subject line grabbed my attention!) Grab it from http://minstrelhall.com/RosMudAndroid.py and give it a whirl! I haven't tested the code lately. I don't remember whether it's for Python 2 or Python 3. Feel free to pester me with questions; I've written several MUD clients (in various languages) and a couple of MUD servers, and would be happy to share oddments of code with you. Chris Angelico aka Rosuav -- http://mail.python.org/mailman/listinfo/python-list