Giter VIP home page Giter VIP logo

pycat's Introduction

Rationale

Existing MUD clients either

  • invent their own scripting language, which usually sucks (Tintin++)
  • are written for Windows, and require jumping through crazy hoops to get to work right on Linux/Mac (MUSHclient+Python used to require installing Python + Pywin32 in Wine (and these days it's just plain impossible))
  • are optimized for Lua, and Python is either absent, or a second-class citizen (MUSHclient can't do cross-module function calls in Python, Mudlet is Lua only)

There are workarounds for everything, but sooner or later you'll wish you could stop working around, and start working on.

... hence:

pycat

A MUD client inspired by the simplicity of netcat, written in Python, in a modular and hackable way. Its features:

  • Works as a proxy: you run pycat, then connect a regular basic MUD client to localhost
  • Caching: if your frontend MUD client disconnects from pycat, it'll keep running triggers/timers and accumulating output. Upon reconnecting, it'll dump the whole output into your MUD client.
  • No redundant functionality. In particular, no Readline support.
  • Modular, layered design
    • Telnet connection (supports GMCP)
    • A base client (implements command stacking, #number spam, talks to modules)
    • A bunch of modules doing their own things (for example, the Logger module triggers on all MUD output and stuffs it all into a file)
    • Your 'client' which brings together the modules you want to include (here it's possible to bring in MUD-class-specific stuff)
    • Most of the code is reloadable at runtime
  • Triggers, replacements, aliases, yada yada, anything you can implement in Python
  • GMCP-based automapper

howto

  1. Clone the repo
  2. Install Python3
  3. Edit the `sample.py, specify the host/port to connect to
  4. run python3 ./pycat.py sample 4000
  5. connect a regular MUD client to host ::1 port 4000 (edit the bind address and socket address family if your frontend MUD client doesn't support IPv6)
  6. write your own world module. There's a bunch of sample code in coffee.py. You can pass command-line parameters from pycat to your world module.

pycat's People

Contributors

abair avatar cizra avatar silasary avatar vnd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pycat's Issues

Repeat Module Cannot Send a Newline

When using the repeat module, sending a blank line will repeat the last line you sent; however, there's no way to send a newline or an empty line to the mud. This messes up paging readers that require a blank line to go to the next page. I tried editing repeat.py to add this functionality, but I can't seem to get it to work.

Uncatchable Exception in Select Statement

Even when catching keyboard interrupts, there's an uncaught exception when exiting the program via C^c:

Exception ignored in: <module 'threading' from '/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py'>
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1583, in _shutdown
    lock.acquire()
KeyboardInterrupt:

I believe this is caused by an exception in the generator cleanup. We need to exit the select statement more gracefully in general. This is just a theory because I'm a little out of my depth here.

Here are two StackOverflow articles that may help explain what's happening:

runme.sh fails with missing libraries errors

I've tried to execute runme.sh and it fails with the same errors on Ubuntu 16.04 and Ubuntu 18.04 (if host system matters at all).
Note: I supposed that runme.sh is what is supposed to be executed, would be nice to add it to README if that's the case.

/home/pycat
/home/pycat/.abuild
/home/pycat/.abuild/pycat-5d64fa91.rsa
/home/pycat/.abuild/abuild.conf
/home/pycat/.abuild/pycat-5d64fa91.rsa.pub
/home/pycat/packages
/home/pycat/packages/pycat
/home/pycat/packages/pycat/x86_64
/home/pycat/packages/pycat/x86_64/APKINDEX.tar.gz
/home/pycat/packages/pycat/x86_64/rlwrap-doc-0.43-r0.apk
/home/pycat/packages/pycat/x86_64/rlwrap-0.43-r0.apk
/home/pycat/rlwrap
/home/pycat/rlwrap/APKBUILD
/home/pycat/pycat
(1/1) Installing rlwrap (0.43-r0)
Executing busybox-1.30.1-r2.trigger
OK: 527 MiB in 102 packages
Removing intermediate container 4cd0ab33579e
 ---> 98bfdc32e770
Step 17/17 : CMD cd pycat/mapper && make test && cd .. && ./start_client.sh
 ---> Running in 37380cfd1509
Removing intermediate container 37380cfd1509
 ---> e247208f40f1
Successfully built e247208f40f1
Successfully tagged pycat:latest
g++ -isystem /usr/include/python3.6m -c -std=c++14 -fPIC -Wall -Wextra -g -O0 -fmax-errors=1 -Winvalid-pch -o test_pch.hpp.gch test_pch.hpp
g++ -isystem /usr/include/python3.6m -c -std=c++14 -fPIC -Wall -Wextra -g -O0 -fmax-errors=1 -Winvalid-pch -o test.o test.cpp
g++ -isystem /usr/include/python3.6m -c -std=c++14 -fPIC -Wall -Wextra -g -O0 -fmax-errors=1 -Winvalid-pch -o mapper_pch.hpp.gch mapper_pch.hpp
g++ -isystem /usr/include/python3.6m -c -std=c++14 -fPIC -Wall -Wextra -g -O0 -fmax-errors=1 -Winvalid-pch -o mapper.o mapper.cpp
g++ -shared -o libmapper.so mapper.o
g++ -o unittest test.o -Wl,-rpath=`pwd` -L`pwd` -lmapper -lboost_unit_test_framework -lboost_serialization -lboost_python3 -lpython3.6m
**/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lboost_python3
/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lpython3.6m**
collect2: error: ld returned 1 exit status
make: *** [Makefile:35: unittest] Error 1

Running in windows? 'Session' object has no attribute 'pipeToSocketW'

Having issues running in windows. (is this windows compatible?)

updated sample.py w/ mud URL and port

attempted to run pycat.py sample 4000

received error: "An operation was attempted on something that is not a socket"

Is this an end user issue? Am I doing something wrong?
I tried looking at the closed issues first before adding a new issue but didn't see an answer.

in line 27 of pycat.py I tried changing ::1 to 127.0.0.1 and running pycat.py sample 4000
received "'Session' object has no attribute 'pipeToSocketW'"

Content display issues

I'm experiencing infrequent but regular issues:

  • text output jumps to the top of the screen, and until enough text is received from server old and new text is mixed. Workaround: hit enter key 20 times or so.
  • cursor permanently jumping to the top of the screen, so effective screen height becomes 2-3 lines of text. Only exiting pycat and resetting terminal helps.
  • some random bytes inserted in between input command, for example: 'c slow' becomes 'c slo1;2cw'

Where should I look if I want to fix this? Pycat itself or some of underlying libraries?

Howto?

Is there a how to available?
It's a bit cryptic trying to determine which basemodule we need to use and how to feed it an IP for a mud.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.