"""This is the basic framework for writing a robot in Python."""# this will work with any mud - these settings are for one where it's OK to run bots and mess around.from telnetlib import Telnet #see [docs.python.org]host = 'pearachute.net'port = 9998t = Telnet()"""This first bit is sort of advanced, and you don't really have to understand it - butwhat it does, is when you launch this script, you can pass it an extra argument,and it will try to import that argument and run the strings from the mud through that.that way, you can write different bots/characters without rewriting this every time! :)"""import systry: _foo = __import__(sys.argv[1],globals(),locals(),['proc','triggers']) proc = _foo.proc triggers = _foo.triggersexcept Exception, e: print e,'\n','print-only:' def MAGIC(tuple): sys.stdout.write( tuple[2]) triggers = ['\r\n']#this is a convenience, it hits enter at the end of linesdef write(msg): if msg: t.write(msg + '\n')def main(): t.open(host,port) while True: write( MAGIC( t.expect(triggers)))if __name__=='__main__': main()"""MAGIC is the magic in this program. It takes the data coming from the mudand can (optionally) return a string, which will be sent to the mud.I'll explain more in part 2! WALDO THE WANDERBOT! ;p"""