I have just played a remarkable game in Vorple. Something about this game prevented it from working for me in Firefox, but I was able to get it to work on Edge, and I created a transcript as I was playing. However, the Vorple documentation about extracting the transcript from the virtual directory is a little bit beyond me—I know enough to be dangerous, but not enough to actually get the data out in a useful format. Behold, a screenshot:
As you can see, I’ve found my way into the Developer Tools and I’m looking at the IndexedDB space where Vorple saves transcripts. I found the key whose array buffer contains the actual transcript, as the memory inspector demonstrates. However, I cannot figure out how to turn this into a txt file!
While I found a few StackOverflow pages that seem to address this subject, nothing I actually put into the console worked, and I’m too out of my depth to experiment much. My comfort with JavaScript doesn’t extend beyond the old onMouseOver script I used to use in the late 90s to hide secret links around my website that wouldn’t show up as different addresses when you’d put your mouse over them. Anybody know what I should be doing here?
If the game uses the standard Quixe save/load dialog box, you can get at the transcript by typing RESTORE, hitting the Edit button in the dialog box, selecting the transcript, and hitting Display. You then get a scrollable pane with the transcript.
(I don’t know if Vorple uses this system at all, though.)
Oh gosh, I forgot that while I was banging my head against this last night, I found a post you’d made earlier in response to a similar question! I tried this, and when Vorple gives me the restore dialog, there wasn’t an Edit button showing:
I think this might be unique to Edge, which is unfortunate as Edge is the only browser I can finish loading the game in—on other browsers, it hangs for me during one particular “wait for any key” prompt.
A friend recommended that I try using ChatGPT to generate the script to obtain this data. I figured it couldn’t hurt to try, and since in the end the process was at least partially successful, I thought I’d save the conversation for public review.
I do have a modicum of programming experience, and the process of using ChatGPT felt like it still ran me down just as many blind allies as I would have were I approaching this problem on my own, but at least it produces commands that run without issues—provided I’ve supplied it with an accurate representation of what I’m trying to accomplish.
I ran into two issues that I presume are a consequence of my poor understanding of how Vorple and the virtual filesystem work:
While I was able to generate a text file containing the text produced by the interpreter, none of the typed commands from the player were included in this log.
The way that the transcript data accumulates in Vorple appears to be that it produces a complete log of all the text produced by the interpreter so far in response to each command the player types. If there are ten commands, there are ten transcripts: one that contains only the opening, one that contains the opening and the response to the first command, one that commands the opening and the response to the first two commands, and so on. I presume that there is some process by which these separate transcripts are snipped of redundant text and sewn together with the player’s commands (from… wherever they’re stored) before the completed transcript is generated, but the data I was able to access was prior to any such operation. I played for hundreds of turns, so this file was a little bottom-heavy.
If anybody has further recommendations, I’ll be happy to hear them, but for now I can at least start hand-editing the file I obtained into a useful format.
EDIT: Leon Arnott was able to find some info on Vorple transcripts that confirms the commands aren’t able to be included when they’re generated, and it seems like transcripts with the same name do not overwrite one another, but instead simply append data. However, there’s way, waaaaay too many copies of the transcript in this file for that to be the only thing going on, so I assume my original understanding that each command copied all the game text produced so far had at least some truth to it as well.
Working on a recent project, I found a solution for getting complete transcripts (including player commands) working in Inform7/Vorple. The problem has two parts:
Vorple only logs responses in transcripts by default, omitting player commands (and no one wants incomplete transcripts)
The transcript is stored in IndexedDB but needs a way to be downloaded
Here’s how to fix these problems:
First, in your Inform code, add this to capture commands in the transcript without double-printing them:
transcript-on is a truth state that varies. transcript-on is false.
Carry out switching the story transcript on:
execute JavaScript command "showHideTranscriptButton('none');";
now transcript-on is true.
Carry out switching the story transcript off:
execute JavaScript command "showHideTranscriptButton('block');";
now transcript-on is false.
command-echo is a Vorple style.
After reading a command:
if transcript-on is true and Vorple is supported:
let cmd be the player's command;
say "[command-echo style]>[cmd][end style]";
continue the action.
The end transcript rule is listed in the shutdown rules.
This is the end transcript rule:
if transcript-on is true:
try switching the story transcript off.
Then in your HTML/JavaScript, add these elements:
Add this CSS to hide the echoed commands in the display: .command-echo { display: none; }
Add this JavaScript to handle the download button and transcript retrieval:
function showHideTranscriptButton(show_me) { // show_me = none | block
const ting = document.getElementById('downloadTranscript');
if (ting) {
ting.style.display = show_me;
}
}
function downloadLatestTranscript() {
const fs = vorple.file.getFS();
fs.readdir(vorple.file.TRANSCRIPT_PATH, function(error, files) {
if (error) {
console.log("Error reading transcript directory:", error);
return;
}
if (files && files.length > 0) {
// Get the most recent transcript file
const latestFile = files[files.length - 1];
fs.readFile(
vorple.file.path(latestFile, vorple.file.TRANSCRIPT_PATH),
"utf8",
function(error, contents) {
if (error) {
console.log("Error reading transcript:", error);
return;
}
// Create and trigger download
const blob = new Blob([contents], {type: 'text/plain'});
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = latestFile;
a.click();
window.URL.revokeObjectURL(url);
}
);
}
});
}
Create the download button in your initialization code:
The Inform code captures player commands and adds them to the transcript because we “say” the command with a special CSS style
The CSS hides these commands in the player’s display (so we don’t see them twice) but they still get logged to the transcript
When the player types “transcript on”, the collection begins
When the player types “transcript off” or the game ends, they can click the button to download the complete transcript
The result is a tidy transcript that includes both commands and responses, accessible through a download button. Hope this helps others who were struggling with this issue as I was.