I've come far, but still can't get transcripts automatically recorded. Seeking urgent help

I want transcripts of a game on my website to be automatically recorded via the IF Recorder technology originally assembled by Juhana (Github project: GitHub - juhana/if-recorder: Recorder for interactive fiction transcripts)

I really want to get this working this week, before xmas holidays strike. So if I’ve built up some karma, this is the time I’d like to call it in for urgent assistance. I’ve spoken to Mark Musante, tried to get onto JMac (no response), and Danni has helped me get as close as I have, then suggested I return here.

The situation: I’ve set up a game on a website with Parchment. For this exercise, we’re using Captain Verdeterre’s Plunder.

To do this, I built Parchment from github (GitHub - curiousdannii/parchment: The Interactive Fiction player for the web). I then followed the IF Recorder github instructions and set up a mysql database on the same domain to receive the transcripts, as well as adding the IF Recorder’s database/sql scripts to my parchment installation. I tested the connection between the scripts and the database: they pinged the message indicating there is a connection, as per IF Recorder’s installation instructions.

Danni got me past all the IF Recorder instructions that were out of date (apparently its javascript files are no longer needed, nor is its index.html) and told me what variables to put in the index.html file:

    <script>
        parchment_options = {
            default_story: [ "interpreter/Captain-Verdeterres-Plunder.gblorb.js" ],
            lib_path: 'interpreter/',
            recording_url: 'tools/server/save-sql.php',
            recording_format: 'simple',
        };
    </script>

Now, when I visit the webpage –

https://wadeclarke.com/cap/

– the game plays, and the javascript console claims it’s starting to record a transcript, but nothing shows up in the database after QUIT. Nor is there an ‘ok’ message from the sql script at any point, the thing Juhana’s (ten-year-old) instructions said to expect.

One time, while stuffing around with the parameters, I did see entries for the game being played show up in the database, so I don’t think the database connection per se is the problem. You may be thinking, ‘Why didn’t I pounce on that moment?..’ Well, at that point, a lot of parameters were completely wrong. I may have just been pinging the db.php script that connects to the database in the first place. But db.php is the first inclusion in the server script (tools/server/save.sql.php), so why am I not even getting that much data now? I don’t know.

Here’s the cap directory’s contents with the path to a couple of important bits revealed (tools/include/db.php and tools/server/save.sql.php)

Summary

If I/we could get at an example from IFComp’s site (where we know this is working) that would be great, but like I say, Jacq sent me to Mark sent me to JMac and JMac hasn’t come back.

Thanks.

-Wade

Looking back at conversations I had with jmac in the past, I got a custom game to record transcripts on the website through this code (quote from email):

I replaced the game_options in my index.html with the following:

<script type="text/javascript">
game_options = {
  use_query_story: false,
  set_page_title: true,
  recording_url: '/play/1631/transcribe',
  recording_label: 'The Absence of Law',
  recording_format: 'simple'
};
</script>

Oh man, I can’t wait to try this! It looks like I had the recording_url set to the mysql script, but you’ve got it set to… what? Is transcribe a directory? A file?

-Wade

I believe it was a directory, but I can’t remember.

Do you happen to have the whole index file? Some of the ‘game options’ are parchment options in my version. I guess I need to see if the file is using both of these, or mixing them, or… etc.

-Wade

Can’t upload html on here but here’s the raw code:

<!DOCTYPE html>
<html>
<head>
  <title>Brian Rushton - The Absence of Law — Play</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  <meta name="viewport" content="width=device-width, user-scalable=no">
  <meta name="author" content="Brian Rushton">
  <link rel="stylesheet" href="style.css">
  
  <link rel="stylesheet" href="interpreter/glkote.css" type="text/css">
<link rel="stylesheet" href="interpreter/dialog.css" type="text/css">
<script src="interpreter/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="interpreter/glkote.min.js" type="text/javascript"></script>
<script src="interpreter/quixe.min.js" type="text/javascript"></script>

<script src="interpreter/resourcemap.js" type="text/javascript"></script>

<script type="text/javascript">
game_options = {
  use_query_story: false,
  set_page_title: true,
  recording_url: '/play/1631/transcribe',
  recording_label: 'The Absence of Law',
  recording_format: 'simple',
  inspacing: 0,     // gap between windows
  outspacing: 0     // gap between windows and edge of gameport
};
</script>

<script src="interpreter/The Absence of Law.gblorb.js" type="text/javascript"></script>
  
 </head>
<body class="play">
<div class="container">
<div class="coverimage"><span><a href="Cover.png"><img src="Small Cover.png" border="1"></a></span></div>
<div class="links">
<div class="smalltitle">The Absence of Law</div>
<ul>
<li><a href="index.html">Home page</a></li>
</ul>
</div>

<div id="gameport">
<div id="windowport">
<noscript><hr>
<p>You'll need to turn on Javascript in your web browser to play this game.</p>
<hr></noscript>
</div>
<div id="loadingpane">
<img src="interpreter/waiting.gif" alt="LOADING"><br>
<em>&nbsp;&nbsp;&nbsp;Loading...</em>
</div>
<div id="errorpane" style="display:none;"><div id="errorcontent">...</div></div>
</div>
<audio id="morning" preload="none" loop>
<source src="Musopen_-_Morning.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="clunky" preload="none" loop>
<source src="Clunky-Old-Time-Piano.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="coldmoon" preload="none" loop>
<source src="Cold-Moon.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="dazed" preload="none" loop>
<source src="Digitally-Dazed.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="battle" preload="none" loop>
<source src="Into-Battle.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="strange" preload="none" loop>
<source src="Moment-of-Strange_Looping.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="spangled" preload="none" loop>
<source src="the_star_spangled_banner.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</audio>
<audio id="defense" preload="none" loop>
<source src="Tower-Defense.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="future" preload="none" loop>
<source src="The-Triumph-of-the-Clock-Maker.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="probe" preload="none" loop>
<source src="Little-Space-Probe_Very-Big-Journey.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="switch" preload="none" loop>
<source src="Switch-On_Looping.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="pomp" preload="none" loop>
<source src="Pomp_and_circumstances_No_1.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio id="puzzle" preload="none" loop>
<source src="Puzzle-Dreams.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</body>
</html>


Edit: Oh, I just realized…I think this is Quixe, which probably throws everything off.

So maybe I was wrong that GlkOte is set up to use the same protocol as the original IF Recorder plugin. The same error, “POST data not found” was reported here:

So you don’t need to worry about the recording_url being wrong, that’s correct.

Instead the problem is the PHP server doesn’t know how to interpret the data that’s given to it. I suspect this won’t be hard to fix, but my PHP is very rusty…

Before the line saying

if( empty( $_POST[ 'data' ] ) ) {

can you add this code?

var_dump($_POST);

It looks like @Juhana changed things dramatically in this commit, but I don’t know for sure what should be done now. Whether GlkOte is in simple or glkote transcript mode, it always passes the data to the server as JSON, not as application/x-www-form-urlencoded data.

I’m laughing, as you’d think I’d have learned that by now (when the URL points to the sql script, that’s the only time I get as far as I have) but I keep jumping at it, over and over.

I’ll try it.

-Wade

Thanks, I can see you’ve made the change now. Unfortunately I still don’t know how to fix it…

I’ll see if I can set up an install myself to test more.

This is untested, but might work!

Try replacing this:

if( empty( $_POST[ 'data' ] ) ) {
	die( 'POST data not found' );
}

$data = $_POST[ 'data' ];

with

$data = json_decode(file_get_contents('php://input'), true);

Thank you!

I’m going for a lunch and sanity break.

PS - Do we know what’s going on with Brian’s version of index? I mean it looks similar overall, but unless the ‘transcribe’ was the sql script, I don’t see it locating a script.

-Wade

I assume that was for the IFComp site, which has ported the save-sql.php script to perl.

Okay, I made that substitution and the outcome has not changed.

Would you like me to link you a zip of the cap folder?

-Wade

Success, finally!

I’ve hacked together an update for save-sql.php that will work with the modern GlkOte design: if-recorder/save-sql.php at glkote · curiousdannii/if-recorder · GitHub

You will need to set the story name in the URL like this:

recording_url: 'tools/server/save-sql.php?story=cvp',

(Though I’ve just realised I could probably have used the recording_label option instead. Oh well.)

The built in viewer appears to work, at least when I’ve been testing it. I didn’t have to change any of its code.

I had to hack out a lot of it - for example it will say that every transcript has 0 turns. More work could be done to fix that I’m sure, but I’m probably not the right person for it. My PHP is very rusty now. It might actually be better to start from scratch for the server software.

My take away from this is that I don’t think that the GlkOte recording functionality was ever intended to work with Juhana’s original IF Recorder server, it’s just too different. I don’t know how the IFComp site handles both protocols then.

2 Likes

Late but better than never, I am reporting that I got the Inform-game-on-a-website transcript recorder working a few weeks ago after some extreme help (nineteen emails et al.) from @Dannii . Again, a mighty thanks to Dannii.

In case you want to make this happen on your website, I’ve attempted to write some detailed instructions of the whole process. They start by going over prerequisites for your knowledge and tech requirements, so you can decide if it’s worth trying.

Note that the task, like Nirvana’s third LP, is not one for wimps, and my instructions are probably highly criticisable. Still, when I started this and had bugger all, I’d have killed to have had these instructions.

Disclaimers:
Being highly specific, the instructions will be prone to go out of date faster. And Dannii has, or is just now, updating Glkote itself. I hope that won’t break everything I’ve learned/written, but that’s for the future. For now, I feel confident saying these instructions are the best anybody’s ever written on the subject. They’re in the attached text file.

setting up parchment and if recorder 2021.txt (8.7 KB)

-Wade

4 Likes