If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Profanity... a terminal frontend

I just uploaded the terminal frontend I've been working on. It's based on Ruby and ncurses. The two main reasons I decided to make this was: 1) It runs natively on Linux. and B) You can use it in a terminal emulator on Android using a ssh connection to your normal computer.

This is a very early release. Basically nothing can be customized right now without editing the code. That's probably what I'll be working on next.

Regex highlights are cool. As you might guess, you can do things like /[A-Z][a-z]+ disk/ to highlight disks and the owner's name, without having to add a highlight for each player in the game. But you can also do weird stuff like /(?<!uncut )diamond/ to highlight "diamond", but only if "uncut " doesn't come before it.

It's not exactly user friendly yet... but if you want to play around with it here's how you might do that:

First, you'll need Lich 4.4.14.

Download profanity.rb from the link above. You can put it anywhere, but I just put it in my Lich folder.

--without-frontend means it's not going to try to start a frontend and wait for it to connect to Lich and then connect to the game. It's going to get a login key and connect to the game without any way for you to see the output or give it input.

--detachable-client=8000 means it's going to listen for a client to connect on port 8000. The client can connect or disconnect as much as it wants, and Lich will stay connected to the game.

I don't intend for this to be the only way to use the frontend, but I play Shattered so I made it to work for me first.

Now, you can start Profanity and connect to Lich on the port you specified (8000 in the example).

On Linux, you may need to type "export TERM=xterm-256color" to enable 256 colors.
./profanity --port=8000

On Android, I've been using the terminal emulator named "Android Terminal Emulator" by Jack Palevich with preferences > terminal type set to screen-256color
ssh your_user_name@your_ip_or_dyndns_or_something
/path/to/profanity/profanity --port=8000 --custom-colors=no

On Windows... um.. you could use cmd.exe... but you probably shouldn't.
ruby.exe profanity.rb --port=8000

I haven't tried it on OSX. I assume it's the same as Linux.

--custom-colors=no means it won't try to redefine the terminals colors. The script asks the terminal if it supports changing the colors, and in the case of the Android Terminal Emulator, it lies. So to keep it from looking like complete crap, you have to turn custom-colors off.

Colors in the script are defined by html codes. In 256 color mode, with custom-colors on, it should have the appearance of unlimited colors. The script will continue to redefine the least recently used color slot whenever a requested color isn't defined. So as long as there are fewer than 256 colors on the screen at any given time, everything should be fine. When custom-colors is off, the script attempts to find the clostest matching available color.

Some keys:
page up/page down scrolls the current window up and down
alt+page up/alt+page down scrolls the current window 1 line
tab changes the current window, indicated by the scrollbar

command prompt should work as expected except ctrl+enter, alt+enter, ctrl+left/right, copy/paste are not yet working.

Typing .quit will close the frontend, but not exit the game.
Type .resync if the roundtime bar isn't right.
Don't type .e
Any other command starting with a period gets changed to a semicolon before it's sent, because it's easier to hit the period on Android.

You know, I read the title of this thread and thought someone took pity on Dayko and created a script to help him curb his in-game use of profanity.

That being said, this thing is awesome, Tillmen. Now I want an android. =(

You slap Walkar's cheek, hard.

He continues, "I've decided that I'm not going to let you serve community service, so don't get your hopes up. To this aim, you may either pay the fine of 50000000 silvers plus any other outstanding debts you may owe, or serve a total of 120 minutes of incarceration. You may ANSWER me either FINE or INCARCERATION as your choice. But I digress. Choose quickly, now, lest I hold you in contempt of court for wasting my time."

This is apparently a problem with the Ruby version you're running. It happened for me, too, when I was running Ruby 1.8.7 in Windows. However, I installed Ruby 2.0, and I no longer get this error. In fact, I got this working on Windows!

After you install Ruby 2.0, you will still get an error, but it will be a different one. Ruby 2.0 (or Windows, not sure which) has a problem with the IP address that profanity.rb has on line 1031. At line 1031, it says:

Code:

server = TCPSocket.open('0.0.0.0', PORT)

You'll need to change that to the following:

Code:

server = TCPSocket.open('127.0.0.1', PORT)

This tells it to connect to your local computer. Once you make that change, save profanity.rb. Then, from the command line, run:

Code:

ruby.exe profanity.rb --port=8000

and it will connect successfully.

By the way, for my part, I installed Ruby 2.0 separately from Ruby 1.8.7, so that I still have both on my computer. You might want to do that, too. In that case, instead of just typing "ruby.exe profanity.rb --port=8000", you may have to provide the full path to Ruby 2.0, e.g., "C:\Ruby200\bin\ruby.exe profanity.rb --port=8000".