ClubFloyd on Slack?

So, I messed around with remglk some more. I’ve gained a lot of confidence in compiling! The output actually converts to a python data structure pretty gracefully, with some minor substitutions. I’m not sure the advanced output is really needed for Slack (which supports bold, italic, and strikethrough by default but may do more formatting in a more advanced way, I haven’t gotten that far). But it’s definitely possible to get that info out.

Parsing blorbs is super easy (especially for zblorbs where you can just discard everything but the gamefile), so if you can’t get any terps with built in support working it wouldn’t be hard to parse the blorbs first.

Bocfel is a good terp, and if you have any trouble with it, and it’s author is cas on these forums.

I think you mean, ‘super easy when you know what you’re doing’. :laughing: This has definitely been a learning experience for me. The sad thing is, after finishing it up and proudly launching it on our slack domain, I received multiple apologetic DMs saying that when it was an abstract idea it sounded awesome but now that it’s a reality, nobody has the time or inclination to play. But it’s been a very worthwhile process, teaching persistence if nothing else!

I ended up linking bocfel to cheapglk and the output from the zblorbs parses to slack just fine (as far as I can tell). The script supports using a number of different interpreters or just one (more a feature of how the interpreters work than anything I did) so someone could set up a game, try it out, and use the interpreter that works best for them.

If anyone tries it out (maybe plays a whole game even!) and has any issues, please let me know!

The readme says

As far as the instructions on this are concerned, I definitely fall into the “don’t know what I’m doing” category. Assuming none of the invited users are trying to make trouble, are there any other risks I need to be concerned about?

I’m stuck on this step:

When I go to the python slack client github page, it says to install it, you do this:

So, those look like commands to be typed in, but I don’t know where to type them in. I set up Ubuntu in the VM because it was easier to follow the tutorial I was using if I did it that way. Do I need Python?

I looked up pip, and got to this page, which says “To install pip, securely download get-pip.py. [2]”. And that links to this, which opens in my browser like a web page or text file. So I’m not sure how to download it.

And it says to run this

to install it…but I’m not sure how to do that.

I imagine this is obvious to people with a programming background, but it’s not to me, so I would greatly appreciate a nudge in the right direction.

You do need Python. Pip is Python’s version of apt-get or whatever, for automatically installing modules. It comes with most versions of Python so you shouldn’t need to worry about that part once you have Python working.

Thanks!

I’ve now gotten to the point where I’m trying to run a game, and I get

Progress! :wink:

Thanks for putting this all together! I finally managed to get it working, and played through a short game with Glulxe. The only issue i saw was that saving the game doesn’t seem to work.

For anyone else who’s trying to set up slackif.py with Ubuntu, and doesn’t know anything about Ubuntu, here are some details about the steps I struggled with, and what ended up working. I used Ubuntu because it was easiest to follow the virtualbox tutorial but it was new to me. The step numbers below are referring to the steps in the readme of slackif.py.


[size=125]From step 1 of the readme:[/size]
To mount the shared folder, I followed these instructions (they are for virtualbox): forums.virtualbox.org/viewtopic.php?f=3&t=15868

After adding the folder in the virtual machine settings, I opened the terminal and used this command to mount:

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 shared_folder ~/mounting_place (Substitute your own values for shared_folder and mounting_place.)


[size=125]For step 3 of the readme:[/size] to install the slack client, here is what I ended up doing on Ubuntu 14.04.03. The process here may or may not be the way using a virtualenv is actually supposed to be done, but it seems to have worked, insofar as it allowed me to install slackif.py.

Download and extract the python slackclient zip into the shared folder.

To install virtualenv (since the slack client readme suggests using virtualenv, and because I gather using a virtualenv gives you pip also):

Instructions from virtualenv.readthedocs.org/en/la … ation.html say:

You have to replace x.x with the version number of virtualenv. When I checked, the latest version of virtualenv at pypi.python.org was 13.1.2.

For that fourth line, I also chose to specify the version of python. I’m not sure if this was necessary, but at some point, the default version of python was giving me an insecure platform warning. So this is what I actually entered in the terminal:

curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.1.2.tar.gz tar xvfz virtualenv-13.1.2.tar.gz cd virtualenv-13.1.2 sudo python3.4 setup.py install

To create a virtual environment:
In the terminal, navigate to the home directory.

Theoretically you can create a new environment like this:
virtualenv my_new_environment

But when I tried that at some point (I forget in conjunction with what other steps I took) I got an insecure platform warning. So instead I did it with a newer version of Python, specifying the path where it’s found:

virtualenv -p /usr/bin/python3.4 my_new_environment

(You can substitute your own value for my_new_environment. Command adapted from here: stackoverflow.com/questions/1534 … nv#1534343)

To activate the new environment:

. my_new_environment/bin/activate (That command came from here: askubuntu.com/questions/675234/o … d-usr-loca)
I think you also have to activate the environment anytime you want to run a game. I seem to have to navigate to the home directory before activating–not sure if that’s universally true.

To actually install slackclient:
With the environment active, navigate to the appropriate folder (either “slackclient” or its parent, I forget)

pip install slackclient

[size=125]Some suggestions about step 10 (trying to use the script via slack):[/size]

If the bot reports in ok but you get errors when you try to launch a game, check that the compiled interpreter appears directly in the “terps” folder (not in a subfolder of “terps”) and that the “games” and “terps” folders are in the same folder that contains slackif.py. (So it’ll match the terp and game paths correctly in the slackif.py file.)

You can also go into the gamesdb.py file and check the “interpreter” entry for the game you’re trying to launch to make sure it’s correct. That gets added to the file path when slackif.py tries to launch a game.

There’s also a python debugger called pdb you can use if you are trying to figure out where things are going wrong when you run slackif.py. This explanation was helpful: pythonconquerstheuniverse.wordp … in-python/


Hope this helps somebody. The original readme directions were very helpful, but I still had to google a lot, especially for specifics about the OS.

Sorry to go AFK without notice. I moved across the country. An adventure!

I’m glad to see people are getting use of this. As far as security risks go, I don’t know enough about the process to tell you, which is why I suggested a VM and diligence. There’'s always some guy on the team who has to test the limits, or so I’ve found!

If you’re having issues with saving, I would suggest making sure your paths are set properly in the script, and making sure the directories are writable. Mine works without issues.

A huge thanks to everyone who is helping and experimenting!

Thank you! I wasn’t sure what’d be common knowledge or not so I tried to really be explicit. Probably doesn’t help I picked Debian (wanted super small) instead of Ubuntu!

Thanks absinthe!

Something I haven’t been able to figure out: when a game says “Press SPACE to continue,” how do you communicate a press of the spacebar to the game? Suggestions appreciated (from anyone).

Depends on the library, but most will accept a string containing only a space character (" ") for that.

Ok, thanks! Somehow a string with just a space wasn’t getting through–maybe the python script was stripping out the space or something–but we’ve found a workaround.

There’s also a unicode decode error that seems to be set off when a game uses an unusual character, but that’s a separate problem.

I’m doing similar work. Is there a newer Frotz than 2.4.4 on github: github.com/DavidGriffith/frotz Thank you.

EDIT: Is the source code for FloydBot out there? I can’t find any reference to source code.

DavidG’s frotz is the most current frotz.

The bot-to-remglk connector is called Sleepmask: github.com/ziz/sleepmask

If you want a Glk Z-Machine terp, the two common ones are Bocfel and Fizmo.

And in fact, if what you’re after is a RemGlk Z-Machine terp, the Fizmo already supports that.

I am reminded that Floyd’s own source is at ifmud.port4000.com/floyd-pl.txt . (Thanks ggg)

Cool, thanks for all the answers!