Profanity filter for Hugo interpreter or gargoyle?

I was pleased to see that a chrome profanity filter works on HugoJS, making Sherwins games much more playable.

Unfortunately, you can’t save cryptozookeeper online. Is there any way to hook up a profanity filter to a Hugo interpreter? Even if I could just put a regex somewhere in the interpreter code on github. Any suggestions?

[The User was warned about the contents of this post. - Hanon]

I had a comment from the mods on my post for being somewhat rude to Robb Sherwin, and it’s already been resolved via messages.

But I wanted to make it clear that I think Robb Sherwin is a really great author, which is why I’m interested in his games. No Time To Squeal was good, and the parts I’ve played of Cryptozookeeper make it clear that Sherwin has a wonderful turn of phrase, a good sense of characterization, and a number of good settings to pull out.

There’s no mechanism for plugging-in a filter. You’d have to modify an interpreter, implement the filter yourself, and recompile from source.

For the Hugor interpreter, the place you’re looking for is src/hframe.cc:

github.com/realnc/hugor/blob/ma … /hframe.cc

HFrame::flushText() is the spot you’re looking for. fPrintBuffer contains the text to be printed (it’s a QString.)

Thanks for your help! You’ve written some really great code with Hugo. I’ll check it out.

RealNC, I’ve downloaded Qt and gotten fairly far with it, but I don’t see how to install SDL and SDL_mixer. I’ve downloaded the binaries, but I don’t know how to ‘install’ them in Qt. Do you (or anyone else) have any suggestions?

You don’t install them in Qt. You just need to have them available somewhere. On Linux, you need to install the development package of sdl_mixer2 (on Ubuntu for example, it should be named “libsdl2-mixer-dev”). On Windows it’s more complicated; you might need to compile it yourself first.

Alternatively, you can disable audio support when building Hugor, by adding this to the qmake arguments:

CONFIG+=disable-audio

To also disable video (it needs GStreamer, which is even more complicated to set up on Windows, and only one Hugo game out there even uses video), use:

CONFIG+="disable-audio disable-video"

You can add that in the build settings of the project, or you can just add it directly into the hugor.pro file. Modify this:

CONFIG += silent warn_on link_pkgconfig strict_c++ c++14

To this:

CONFIG += silent warn_on link_pkgconfig strict_c++ c++14 disable-audio disable-video

On the general topic of rewriting: This is an area where I think RemGlk can help with IF in general. As it uses standard operating system conventions for stdin / stdout - it is possible to pipe an IF interpreter through a second code that intercepts the JSON and replaces various patterns and then sends it down the chain. I’ve had good success with adapting this to older IF stories to massage output.

Hugo needs to print text (in fact, individual characters) at specific x/y coordinates. And it can print text over other text. It’s not a simple text stream. It’s similar to things like NetHack.

Hugo has a “plain text” mode, which AFAIK is used by the Glk implementation (Gargoyle uses it.) But a “full-on” Hugo implementation needs full control of the screen. I’m not sure how that would look like in RemGlk.

** next comment **

Glk supports character addressing by x/y, use a TextGrid window instead of a TextBuffer window (which is more like a stream). It’s a matter of adding code to interface Hugo to these features in Gargoyle’s GarGlk or any other Glk - and it would automatically be usable in RemGlk too. For example, Tetris / Freefall can be played fine via RemGlk and Gargoyle using a Glk TextGrid window: ifdb.tads.org/viewgame?id=ohjrdv0wx6cd7zzx

You specifically mention Nethack, that can be done via Glk - there is a RemGlk and Gargoyle compatible open source story, Kerkerkruip: youtube.com/watch?v=zvCO9OA9DQQ – the capability is there, Hugo could be enhanced to use the Glk TextGrid features.

Back on topic of filtering/rewrite post-Interpreter: My experience is you could even profanity-filter the regular-language lines of an addressable TextGrid - for example the words “An, uh, Interactive” are on the screen in Tetris / Freefall - and it would be possible to pattern match that and change it to “Jim was Here”.

I’ll have to look into it. It’s a project for another time though.

I have pretty much ignored Glk for the terps I maintain because I wasn’t even sure why I’d want to use it. It seems to be useful for taking an existing implementation of an IF engine/VM that already uses Glk, and then wrap your own front-end around it. But if there is no existing Glk implementation for the IF system you’re writing the front-end for, then it seemed to me that Glk wouldn’t have anything to offer. In this case, the systems in question are HTML TADS and Hugo. HTML TADS doesn’t have a Glk implementation, and Hugo’s Glk implementation is very rudimentary. So it seemed Glk is of no help in this instance.