ForgottenArbiter / CommunicationMod

Slay the Spire mod that provides a protocol for allowing another process to control the game
MIT License
84 stars 18 forks source link

CommunicationMod

Slay the Spire mod that provides a protocol for allowing another process to control the game

Requirements

Setup

  1. Copy CommunicationMod.jar to your ModTheSpire mods directory
  2. Run ModTheSpire with CommunicationMod enabled
  3. Edit your newly-created SpireConfig file with the command you want to use with CommunicationMod (see https://github.com/kiooeht/ModTheSpire/wiki/SpireConfig for the location of your config file). Your config file should look something like this (note that certain special characters must be escaped):
    #Sat Apr 20 02:49:10 CDT 2019
    command=python C\:\\Path\\To\\Script\\main.py

What does this mod do?

CommunicationMod launches a specified process and communicates with this process through stdin and stdout, with the following protocol:

(Note: all messages are assumed to be ended by a new line '\n')

Known issues and limitations, to be hopefully fixed soon:

What are some of the potential applications of this mod?

Frequently asked questions

Communication Mod captures both the stderr and stdout of the external process. All messages sent to stdout are included in the game log, which is displayed in a window by ModTheSpire. All messages sent to the process by Communication Mod are also visible in the game log. The stdout of the external process is logged in a file named communication_mod_errors.log. Instead of printing debug information to stdout, try using a log file.

Communication Mod is probably not receiving a ready signal. Make sure your process sends "Ready\n" to stdout when it is ready to receive commands from Communication Mod. If this is not the problem, there is likely some issue with the command used to start the process. Check communication_mod_errors.log to help debug these kinds of issues.

Try looking at spirecomm, the Python package I wrote to interface with Communication Mod.