curiousdannii/ifvms.js

Use ifvms without Glkote-term

Closed this issue · 3 comments

I want to use ifvms.js as VM library to create a chatbot. And for that I need some way to pass user input to zvm. Previous versions (probably before adding compatibility with glkote-term) had a bootstrap.js with example how to work with vm programmatically, passing strings to the VM and getting the output.
Now ifvms seems to have tight integration with Glkote-term and I unable to get it working with string input.
So the question is: Are there any options to reduce library functionality to be able to do so?

Depends on what you're doing and how. See interpfister/voice-z-machine for an example of running ZVM as a subprocess. If you don't want to handle all of Glk, that's probably a good solution. But Glk is a hard dependency on ifvms now.

It is possible (though not trivial) to replace the glkote.js part of the stack. This receives "display updates" from the VM and updates the browser display; you could change that to receiving updates and flinging them into the chatbot network interface.

(The glkote.js API is very simple, but the display update object is pretty complicated.)

Yes that's another possibility. A simple glkote implementation may not be hard to produce. This one is 270 lines, and most of that is to handle terminal keyboard input -- the input mechanism for a chatbot would presumably have fewer nasty edge cases to deal with (no real character input for example), and so could be shorter.