Last active
May 13, 2022 02:28
-
-
Save emanuele6/3335f4a25b0f46b9ec1aac801f332421 to your computer and use it in GitHub Desktop.
A simple tcl/expect script that gives DELETE key support to jzip (z-machine emulator) so that I can sanely play zork on my laptop. (my laptop's BACKSPACE key does not work)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -- | |
# \ | |
exec tclsh -encoding ascii "$0" "$@" | |
# usage: actually_playable_zork [zork_command] [save_file] | |
package require Expect | |
if {$::argc >= 1} { | |
set zork [lindex $::argv 0] | |
} else { | |
set zork zork1 | |
} | |
spawn $zork | |
if {$::argc >= 2} { | |
set save_file [lindex $::argv 1] | |
send "restore\n${save_file}\n" | |
} | |
set KEY_ARROW_RIGHT "\033OC" | |
set KEY_BACKSPACE "\x7f" | |
set KEY_DELETE "\033\[3~" | |
interact { | |
$KEY_DELETE { | |
send "${KEY_ARROW_RIGHT}${KEY_BACKSPACE}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment