Is it possible to obtain the transcript of a replay in batch mode and then
use a comparison tool like diff to test many replays automatically with only
one batch file ?
I use Windows 9x and I don't know which interpreter would permit this.
If nothing with Windows, then Linux Frotz version, maybe ? (I don't have
Linux installed yet)
Thanks
-- JL
http://jlpo.free.fr
It's messy, but if I understand what you want to do, maybe you could
pipe into JZIP. Have one or more recording files, called something like
mygame.rec, that look like
--
script
mygame.output
y
version
look
go north
kill troll
...
script off
q
y
--
Then a .BAT file including the lines
\(jzippath)\JZIP mygame.z5 <mygame.rec
REM and as appropriate:
\(jzippath)\JZIP mygame.z5 <mygame_alternative.rec
\(jzippath)\JZIP mygame_stable.z5 <mygame_reference.rec
REM and to diff
fc mygame.output mygame_stable_reference.output > diff_file.txt
notepad diff_file.txt
If you have masses of different game files or recordings to compare, you
could use MS-DOS batch loops and file concatenation.
HTH
CK
Thanks, it's exactly what I intend to do.
The redirection into frotz or winfrotz didn't work, so I hope it will work
with JZIP.
>
> --
> script
> mygame.output
> y
>
> version
> look
> go north
> kill troll
> ...
>
> script off
> q
> y
> --
>
> Then a .BAT file including the lines
> \(jzippath)\JZIP mygame.z5 <mygame.rec
>
> REM and as appropriate:
> \(jzippath)\JZIP mygame.z5 <mygame_alternative.rec
> \(jzippath)\JZIP mygame_stable.z5 <mygame_reference.rec
>
> REM and to diff
> fc mygame.output mygame_stable_reference.output > diff_file.txt
> notepad diff_file.txt
I didn't remember "fc" (thanks again)
-- JL
And a horrible idea.
Please please please do not do this.
: Is it possible to obtain the transcript of a replay in batch mode and then
: use a comparison tool like diff to test many replays automatically with only
: one batch file ?
You can also use the beta-testing verbs >RECORD and >REPLAY.
Turn on scripting as the first command in >RECORD and off you go.
-Lucian
The reason piping doesn't work with (DOS) Frotz is that it doesn't take
input from stdin, but from the keyboard. Unix Frotz (and cygwin-compiled
editions thereof) does accept it.
> I use Windows 9x and I don't know which interpreter would permit this.
> If nothing with Windows, then Linux Frotz version, maybe ? (I don't
> have Linux installed yet)
You can use vbscript to access the Windows Scripting Host (WSH) to type
directly into any window. Here's how:
======================
CommandFile = "C:\path\to\cmdfile.txt"
WinFrotz = """C:\path\to\winfrotz"""
GameFile = """C:\path\to\gamefile.z5"""
WaitSeconds = 5
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set TextStream = FileSystemObject.OpenTextFile(CommandFile,1)
set MyShell = WScript.CreateObject("Wscript.Shell")
UselessVariable = MyShell.Run(WinFrotz & " " & GameFile)
MyShell.AppActivate "WinFrotz"
Wscript.Sleep WaitSeconds * 1000
Do While Not TextStream.AtEndOfStream
MyShell.SendKeys(TextStream.ReadLine & Chr(13))
Loop
Set MyShell = Nothing
Set TextStream = Nothing
Set FileSystemObject = Nothing
======================
Some Notes:
You should only have to modify the first four lines.
Save the file with a .vbs extension, you should be able to run it by
double-clicking.
Note the TRIPLE-QUOTES on the second and third lines, and don't take
them out! If you do, it'll get confused over file/folder names longer
than 8 chars.
In your cmdfile.txt, just put a command on each line, like so:
verbose
e
look
quit
Line 4 (WaitSeconds = 5) determines the # of seconds that should pass
before it starts typing in. If this is too short, you'll blow some or
all of your commands while WinFrotz is still loading. Just play with it
until you find the right length for your system.
If you have any windows open that have "WinFrotz" in their header, it
may confuse the program (it uses that to find the WinFrotz executable
for typing).
> Is it possible to obtain the transcript of a replay in batch mode and
> then use a comparison tool like diff to test many replays
> automatically with only one batch file ?
>
> I use Windows 9x and I don't know which interpreter would permit this.
> If nothing with Windows, then Linux Frotz version, maybe ? (I don't
> have Linux installed yet)
Here's the same code I posted before, but modified to handle the file
created by a SCRIPT command issued in-game:
=====================
CommandFile = "C:\path\to\script.scr"
WinFrotz = """C:\path\to\winfrotz.exe"""
GameFile = """C:\path\to\gamefile.z5"""
WaitSeconds = 5
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set TextStream = FileSystemObject.OpenTextFile(CommandFile,1)
set MyShell = WScript.CreateObject("Wscript.Shell")
UselessVariable = MyShell.Run(WinFrotz & " " & GameFile)
MyShell.AppActivate "WinFrotz"
Wscript.Sleep WaitSeconds * 1000
Do While Not TextStream.AtEndOfStream
MyCommand = TextStream.ReadLine
If Left(MyCommand,1)=">" Then MyShell.SendKeys(Right(MyCommand,Len
(MyCommand)-1) & Chr(13))
It's still interesting because WinFrotz displays french accents well
(Windows Frotz 2002 is even better with the input of accented characters)
and because the automatic transcript works too (for now I didn't manage to
start automatically a transcript with JZIP).
-- JL
PS The idea to use a filtered transcript as a list of commands is
interesting too.
"Don Quixote" <donqui...@hotmail.takethispartout.com> a écrit dans le
message de news:
7A9C697B9C3DF7F2.ADC61B98...@lp.airnews.net...
A sample script to test a sample Cloak of Darkness game (not
the Inform version) is appended below. It simply starts the game,
verifies that the expected output is seen ("Hurrying through the
rainswept ...", "Cloak of Darkness", foyer name and description,
and user prompt), inputs the "quit" command, and verifies that the
correct quit output is seen.
load_file set_env.exp
set test "cloak1"
spawn $env(SHELL)
send -- "cd $jigpath\r"
send -- "pwd\r"
set timeout 5
send -- "kaffe Cloak\r"
expect {
-re "Hurrying" {}
default { fail "$test.a" }
}
set timeout 1
expect {
-re "Cloak of Darkness" {}
default { fail "$test.b" }
}
expect {
-re "Foyer of the Opera" {}
default { fail "$test.c" }
}
expect {
-re "south and west." {}
default { fail "$test.d" }
}
expect {
-re "> " {}
default { fail "$test.f" }
}
send -- "quit\r"
expect {
-re "Are you sure (yes/no)?" {}
default { fail "$test.g" }
}
send -- "yes\r"
expect {
-re "Your score was .* point., out of .* possible points." {}
default {fail "$test.h" }
}
pass "$test"
Ben
"JL" <TR...@DE.SPAM> wrote in message news:<3dd7ca6b$0$2154$626a...@news.free.fr>...
> I've just tried this script (thanks!). It works (incredible!) BUT :
> - the keys are sometimes too fast (with many beeps) so I had to add "
> Wscript.Sleep 200 " just before " Loop " but I'm not sure it will
> always be enough
Good point... I had wondered about that. If 200 is too short, you can
always adjust it on the fly.
> - if the active window is changed during the process, the keys are
> sent to it (ie everywhere) !! (it can be dangerous ; it happened, but
> this time I was lucky :-)
Heh, I'd forgotten to mention that. But in all honesty it shouldn't
take too long to iterate through the commands, so just watching it
complete should be fine.
> PS The idea to use a filtered transcript as a list of commands is
> interesting too.
Keep in mind that the transcript feature just looks for lines that start
with ">"... so any commands such as "[PRESS ANY KEY TO CONTINUE]" or
"Are you sure you wish to quit? [Y/N]" will be doomed to failure. It
shouldn't be too hard to error-trap those situations as they arrive
though.
--
"There ought to be limits to freedom." - George W. Bush
I'll explore that too, maybe with Cygwin (because the Windows version seems
to be for NT).
Thanks
-- JL