curiousdannii/ifvms.js

Question: how to differentiate in the output between different streams?

Closed this issue · 4 comments

Currently in my output stream I also get my input that was typed.

I'm wondering if there is a way to differentiate between the output and input stream?

See https://github.com/jedi4ever/ifplayer.js/ for how I try to handle it. Maybe I'm missing something here?

It's part of the Z-Machine spec: http://www.gnelson.demon.co.uk/zspec/sect07.html sec 7.1.1.1.
Though on giving it a fresh reading now, it's really saying that commands must be sent to the transcript, not that they must be output by the VM. If you can't accept input without printing it yourself then I can change it so that the VM will only echo the command if told to.

A :mute input would help, but on the other hand having the complete transcript makes sense to have.

Theoretically it would be possible to strip it of because you have the input string.
My current use case(s) is with readline displays the output while people type, so it get's echoed before you hit enter.

P.S. Did I recently tell you that you are awesome for talking the time on replying to me!

Yes, you're always supposed to be able to see as you type, but when you press enter the interpreter should erase the input. In the case of timed input (which probably doesn't work yet), the spec requires that the interpreter erase what has been typed: http://www.gnelson.demon.co.uk/zspec/sect15.html#read. I'm inclined to just say that this capability is a requirement for ifvms.js. Are you sure you can't do it? I would think that most console APIs should be able to.

I think the IF community on the whole is very helpful, that's how I've found it!

I also appreciate someone else using the code! Your needs will help me tighten up the API a lot.

Now that I've switched to using Glk this is no longer applicable.