textadventures / quest

Create text adventure games
http://textadventures.co.uk/quest
MIT License
304 stars 69 forks source link

kv-6-transcript-redo #1196

Closed KVonGit closed 1 week ago

KVonGit commented 2 months ago

How the transcript works now

There are four attributes on the game object in Quest which concern the transcript :

game.savingtranscript is false by default.


game.notranscript is false by default.


game.transcriptname is self-explanatory. It will be the name the transcript is saved as.


game.transcript_forcecommands is false by default.


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.


Passes all 87 tests: image


Saves games on desktop: image


No JS errors on desktop: image


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): image


Online Game - Your Transcripts image


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!