There are four attributes on the game object in Quest which concern the transcript :
game.savingtranscript is false by default.
When the player enters TRANSCRIPT ON, this will set game.savingtranscript to true, and the transcript will begin to write each bit of text which is output by JS.addText() to a transcript file.
Entering TRANSCRIPT OFF will set game.savingtranscript to false, and the transcript will be "on standby" until TRANSCRIPT ON is entered again.
game.notranscript is false by default.
If this is set to true, the player will not be allowed to record any transcripts during play.
game.transcriptname is self-explanatory. It will be the name the transcript is saved as.
This is not setup in CoreTypes. It is created automatically and set as the game name at startup if it does not exist.
This is not really for the author, as the player is who confirms the transcript name when enabling it.
game.transcript_forcecommands is false by default.
If game.echocommand is false and game.transcript_forcecommands is true, Quest will include the player's commands in the transcript.
That's all there is to it, really.
There are two commands now: TRANSCRIPT ON and TRANSCRIPT OFF.
If using the desktop player, the transcript will be written to "Documents\Quest Transcripts\transcript_name-transcript.txt"
If online, the transcript will be written to localStorage in the user's browser, with the key "questtranscript-transcript_name".
Alex was kind enough to host my first attempt at this code on https://play.textadventures.co.uk/ (so it would be the same URL as the games to make the localStorage the same), but my code had errors (of course). So, I ended up publishing a Quest game to handle things for now; this way I can test it and update it without causing Alex extra work.
That "site" works for everyone who has tested it, but it sure could use a little Pixie CSS magic.
NOTE: Both of those games have a "Transcripts" button inserted by the "Save" button. That button works, but ignore that button and visit the website linked above instead, as I do not have code in Quest to add that (ugly) button to every Quest game!
Changes
Before I list these changes, it is important to note that no one can really use the transcript feature in Quest 5.8 as it stands anyway, and most of these changes are removing bad code.
Online, the game immediately crashes if the player enables the transcript. This is because I added the SaveTranscript() function to "Player\desktopplayer.js" without adding its counterpart to "WebPlayer\player.js". So that function is undefined online, and the game crashes.
In the desktop player, the turn scripts will not fire while the transcript is enabled. The game doesn't actually crash, like the web player does, but it might as well if it breaks the turn scripts.
The transcript now saves to a plain TXT file when using the desktop player.
The transcript now saves to localStorage in the user's browser when using the web player.
Removed the ability to view the transcript from within the game. (Games run much more smoothly when not saving all that data)
Removed the VIEW TRANSCRIPT command.
JS function SaveTranscript() has been replaced by writeTranscriptToFile() in playercore.js.
writeTranscriptToFile() then calls WriteTranscriptToFile(), which exists (with different scripts) in Player\desktopplayer.js as well as WebPlayer\player.js
SaveTranscript() is now included in playercore.js (as a fallback/fix), but it just forwards its args to writeTranscriptToFile()
The JS variable transcriptString no longer exists, as it was negatively effecting game performance exponentially
The JS function replaceTranscriptString() also no longer exists.
The Quest attribute game.transcriptstring also no longer exists
The Quest attribute game.savetranscript no longer exists, as this is now the only option.
The Quest function UpdateTranscriptString has been deprecated. It is still in the code to avoid possible errors, but it does nothing.
Added the ability to overwrite a transcript file, rather than appending to the file.
To do this, include "@@@OVERWRITEFILE@@@" in the string sent to (or from) JS.writeToTranscript(text) each time you would like to overwrite the file rather than append to it.
Fixed error where transcript did not save to the filename entered by the player
Quest will now retrieve any existing 'alt' properties from IMG elements output via JS.addText() for the transcript
In Quest 5.8, ShowMenu creates a link for each option which calls ASLEvent() on click. This link now calls JS.sendCommand() on click rather than ASLEvent().
HandleCommand and HandleMenuTextResponse have been modified to write the player's command to the transcript when game.echocommand is false and game.notranscript is false and game.savingtranscript is true and game.transcript_forcecommands is true
Changed the default value of the JS variable saveClearedText to false. (Saving the cleared text was slowing down games which print good amounts of text.)
The JS function printScrollback() still exists, and it currently works when tested in the desktop player, as well as Firefox and Chrome desktop and mobile version. If saveClearedText is set to true, this will include any cleared text.
Removed all the jQuery-UI pop-up functions added to Quest 5.8 due to walkthrough and saved game issues
The walkthrough will no longer record or run "event:WhereAmI"
The walkthrough will also ignore any ASLEvent calling a function beginning with "NoEventFunc"
Removed *".ogv"** from game.publishfileextensions. I added it to 5.8, but it seems like not including any video formats by default is a good idea, considering the site's maximum file size limit.
Thanks to Pertex and Raist for all the testing and feedback!
Thanks to Alex for creating Quest in the first place, for putting my test web page on the site, and for all the coding I've learned by using Quest!
Thanks to mrangel for providing copious amounts of invaluable wisdom over the years!
And special thanks to @ThePix, who has taught me a great many things over the years, but mostly because said notable is going to have to go through all my recent pull requests!
How the transcript works now
There are four attributes on the
game
object in Quest which concern the transcript :game.savingtranscript
isfalse
by default.When the player enters TRANSCRIPT ON, this will set
game.savingtranscript
totrue
, and the transcript will begin to write each bit of text which is output byJS.addText()
to a transcript file.Entering TRANSCRIPT OFF will set
game.savingtranscript
tofalse
, and the transcript will be "on standby" until TRANSCRIPT ON is entered again.game.notranscript
isfalse
by default.true
, the player will not be allowed to record any transcripts during play.game.transcriptname
is self-explanatory. It will be the name the transcript is saved as.game.transcript_forcecommands
isfalse
by default.game.echocommand
isfalse
andgame.transcript_forcecommands
istrue
, Quest will include the player's commands in the transcript.That's all there is to it, really.
There are two commands now: TRANSCRIPT ON and TRANSCRIPT OFF.
If using the desktop player, the transcript will be written to "Documents\Quest Transcripts\transcript_name-transcript.txt"
If online, the transcript will be written to
localStorage
in the user's browser, with the key"questtranscript-transcript_name"
.For everyone to have access to their transcripts online, I currently have a Quest game posing as a website: https://play.textadventures.co.uk/Play.aspx?id=4wqdac8qd0sf7-ilff8mia
Alex was kind enough to host my first attempt at this code on https://play.textadventures.co.uk/ (so it would be the same URL as the games to make the
localStorage
the same), but my code had errors (of course). So, I ended up publishing a Quest game to handle things for now; this way I can test it and update it without causing Alex extra work.That "site" works for everyone who has tested it, but it sure could use a little Pixie CSS magic.
Also, here are two games designed to test the online transcript functionality, so you'll have transcripts to view on that site: https://textadventures.co.uk/games/view/3r90vfn9su6mcpprpy4arg/online-transcript-tester-20240915 https://textadventures.co.uk/games/view/9mpiy36fr0yi_nufvfiaca/the-transcript-strikes-back
NOTE: Both of those games have a "Transcripts" button inserted by the "Save" button. That button works, but ignore that button and visit the website linked above instead, as I do not have code in Quest to add that (ugly) button to every Quest game!
Changes
Before I list these changes, it is important to note that no one can really use the transcript feature in Quest 5.8 as it stands anyway, and most of these changes are removing bad code.
Online, the game immediately crashes if the player enables the transcript. This is because I added the
SaveTranscript()
function to "Player\desktopplayer.js" without adding its counterpart to "WebPlayer\player.js". So that function is undefined online, and the game crashes.In the desktop player, the turn scripts will not fire while the transcript is enabled. The game doesn't actually crash, like the web player does, but it might as well if it breaks the turn scripts.
The transcript now saves to a plain TXT file when using the desktop player.
The transcript now saves to
localStorage
in the user's browser when using the web player.Removed the ability to view the transcript from within the game. (Games run much more smoothly when not saving all that data)
Removed the VIEW TRANSCRIPT command.
JS function
SaveTranscript()
has been replaced bywriteTranscriptToFile()
in playercore.js.writeTranscriptToFile()
then callsWriteTranscriptToFile()
, which exists (with different scripts) in Player\desktopplayer.js as well as WebPlayer\player.jsSaveTranscript()
is now included in playercore.js (as a fallback/fix), but it just forwards its args towriteTranscriptToFile()
The JS variable
transcriptString
no longer exists, as it was negatively effecting game performance exponentiallyThe JS function
replaceTranscriptString()
also no longer exists.The Quest attribute
game.transcriptstring
also no longer existsThe Quest attribute
game.savetranscript
no longer exists, as this is now the only option.The Quest function
UpdateTranscriptString
has been deprecated. It is still in the code to avoid possible errors, but it does nothing.Added the ability to overwrite a transcript file, rather than appending to the file.
"@@@OVERWRITEFILE@@@"
in the string sent to (or from)JS.writeToTranscript(text)
each time you would like to overwrite the file rather than append to it.Fixed error where transcript did not save to the filename entered by the player
Quest will now retrieve any existing 'alt' properties from IMG elements output via
JS.addText()
for the transcriptIn Quest 5.8,
ShowMenu
creates a link for each option which callsASLEvent()
on click. This link now callsJS.sendCommand()
on click rather thanASLEvent()
.HandleCommand
andHandleMenuTextResponse
have been modified to write the player's command to the transcript whengame.echocommand
isfalse
andgame.notranscript
isfalse
andgame.savingtranscript
istrue
andgame.transcript_forcecommands
istrue
Changed the default value of the JS variable
saveClearedText
tofalse
. (Saving the cleared text was slowing down games which print good amounts of text.)printScrollback()
still exists, and it currently works when tested in the desktop player, as well as Firefox and Chrome desktop and mobile version. IfsaveClearedText
is set totrue
, this will include any cleared text.Removed all the jQuery-UI pop-up functions added to Quest 5.8 due to walkthrough and saved game issues
The walkthrough will no longer record or run "event:WhereAmI"
The walkthrough will also ignore any
ASLEvent
calling a function beginning with "NoEventFunc"Removed *".ogv"** from
game.publishfileextensions
. I added it to 5.8, but it seems like not including any video formats by default is a good idea, considering the site's maximum file size limit.Passes all 87 tests:
Saves games on desktop:
No JS errors on desktop:
The transcript file made by the desktop player: https://github.com/KVonGit/quest5-stuff/blob/main/transcripts/Transcript%20Tester%2020240914-transcript.txt
Saves games in the web player (or it would, if I were logged in, but I am running the web player from VS):
Online Game - Your Transcripts
Transcript from Online Game - Saved As a TXT File: https://github.com/KVonGit/quest5-stuff/blob/main/online%20transcripts%20(saved%20as%20plain%20text)/Transcript%20Tester%2020240914%20-%20Transcript.txt
Thanks to Pertex and Raist for all the testing and feedback!
Thanks to Alex for creating Quest in the first place, for putting my test web page on the site, and for all the coding I've learned by using Quest!
Thanks to mrangel for providing copious amounts of invaluable wisdom over the years!
And special thanks to @ThePix, who has taught me a great many things over the years, but mostly because said notable is going to have to go through all my recent pull requests!