CSGT: Back button, save syncing, variable notifications extension for Firefox

Hi folks,
I’ve been working on developing a Firefox extension to add a bunch of functionality to Choicescript games, including

  • A back button;
  • notifications on variable changes;
  • in-browser viewing of the exact code responsible for a particular line or section of text;
  • autosaving on dashingdon/moody.ink;
  • transferring saves across browsers;
  • assorted animation improvements/fixes;
  • and probably a couple of other things that I’m forgetting.

I’ve mostly been promoting this on my tumblr updated link to csgt specific tumblr, and to be honest I’ll probably continue to do most communication about this there but I thought I’d make a topic about it here in case anybody’s interested! Please reach out if you have any issues with it, or if there’s any other features that you’d appreciate!

EDIT: Forgot to include the Github link!

61 Likes

Oh hell yeah! I’m going to try this. And as much as I hate tumblr, I’ll be keeping up with yours. I’ll try this out later tonight after I finish work!

Thank you!!!

3 Likes

No. Freaking. Way.

Mike Myers Evil Laugh

I am working on something similar, but as an extension for Chrome. What are the odds? I’m including these 2 features, plus a “generate feedback” that creates a report text from template with the file and approximate line number that people can post straight to the forum here and help the author better locate the issue.

High Five GIF by Clarke University

7 Likes

Oh, that’s awesome! I’ve been meaning to try porting this over to Chrome as well, but I haven’t wanted to figure out Manifest V3 so I keep procrastinating :sweat_smile: Automatically composing the feedback report seems like a fantastic feature, I’d love to see your extension once it’s ready!

4 Likes

Yeeeeeees. Let the save system revolution begin!
raccoon-yes

14 Likes

I haven’t done too much yet except for a few scripts that I run straight on the browser to test some hypotheses. I don’t even have a repo yet.

I’m still trying to figure out how to map the source to the generated page. I have a makeshift solution but I’m not 100% happy with it. I’m curious how you solved that. :grin:

That part was a fun challenge! The source for my code is open, so you’re welcome to look through and borrow any bits that looks useful! (You might find this section useful for that particular problem.) I think my solution can still use a bunch of work, but for now it works.

3 Likes

Oh, wow, accumulate the lines inside printLine, that’s so simple.

3 Likes

This works like a freaking charm. I was waiting on a db restore to run and started a game. Everything works so far. No bugs at all! I’ll give it a thorough testing and let you know if I run into anything. The fact that it scrolls to the choices you’re on when you click “Code” is an especially nice trick!

@cup_half_empty If you get it working for Chrome, I’ll grab yours, too. And be happy to test it.

This is just so awesome!! Saves a lot of back and forth with the code. I’d love it if you updated here as well as tumblr, btw. But I get it if you don’t have time.

4 Likes

I’m so glad it’s working well for you! Another fun trick is if you highlight some text on the page before clicking the “Code” button, the code responsible for generating that text will be highlighted (it will also scroll to that code by default)! I’ve found it helpful when trying to track the flow through particularly dense passages.

I’m happy to update here as well as the Tumblr, it’s honestly a better avenue for this sort of stuff anyway!

8 Likes

Hey folks! It’s been a minute, but I’ve got a new update just about ready! Added features in this new update are:

  • Ability to make custom saves in CSGT
  • Ability to delete CSGT saves you’re not using
  • Ability to load CSGT saves directly
  • Increased compression of CSGT saves (~52% → ~40%)
  • Use IndexedDB instead of localStorage

That last point is actually super important and why I’m posting prior to publishing the update, as it has the potential to be slightly disruptive. It’s important because it can entirely eliminate the QuotaExceeded errors that you may have seen when playing/loading some games (especially paid games, as they cache the scene data). I don’t know if many other people encounter this issue, but I certainly have and find it very annoying. It’s slightly disruptive because any data that is stored while CSGT is active will now be invisible if it isn’t active. This is only really relevant when playing games published on choiceofgames.com, so if you play a game while using CSGT and later disable CSGT then your save will be lost.

I’m not sure how much of an issue this would be for people, so I posted a poll on the CSGT tumblr to ask about it, and I’d love to hear any feedback you may have here.

12 Likes

Stupid ask, any chance on making a version for Chromium-based browsers? Or is only gonna be Firefox forever (or at least the foreseeable future)?

Not a stupid ask at all! Chrome (and chromium-based browsers generally) have presented something of a challenge for me. Firstly there’s some features which behave differently across the browsers, including some syntax which needs to change for it to work on Chrome. On top of that Manifest V3 is a headache, and in fact I used Firefox specifically because Chrome kinda sucks to develop for.

All that said I would actually like to get this working on Chrome, it’s just kind of a daunting task that I haven’t wanted to tackle yet. I don’t have an estimate on when I might do that, but I’ll definitely post here when I get to it!

5 Likes

I’ve just published the newest version 1.6.0! It should update automatically soon after it goes live. As mentioned, the QuotaExceeded error has been entirely resolved by switching to use IndexedDB. Additionally, you can now make, load, and import custom saves from in any game (casually adding saves to games published via CoG), although the interface kinda sucks right now so I think I’ll probably revisit that in the near future.

I had said that the compression rate was increased, but I discovered within the last couple of hours that the library I was using had a pretty severe memory leak. I wanted to put out what I had so y’all can start playing around with that, and I can continue running my head into this particular wall some other day.

Please let me know if you encounter any bugs! I would also love feedback if there’s other features that you would find useful.

I can’t thank you enough for both of that. Would you still lose your saves if you erase your browser cookies ?

1 Like

Excellent question! The items that were stored in localStorage (now stored in IndexedDB) will still be cleared if you clear your browser history. However, both your autosaves and your custom saves are persisted in the extension storage, and unless I’m very mistaken they should remain when you clear your cookies.

1 Like

This is great! Doubly so for testing games. Could you add an option to disable animations for notifications and the code window, so that they appear/go away instantaneously?

1 Like

It would be so amazing to get the add-on for android as well, pretty please? :heart_eyes:

1 Like

Yes, absolutely! That’s an excellent idea, and I’ve added it to the list of tasks for 1.6.1.

So funny story, it does actually support Android currently (that’s where I primarily use it actually), but Mozilla has some stupid rules around add-ons for Android. Namely, there’s a very very limited whitelist of addons that you can install on the basic Firefox for Android. However, on Firefox Nightly and Firefox for Android Beta you can install it using a custom collection, and they describe the process here. A quick summary of that process (assuming you’ve installed Firefox Nightly / Beta):

  1. Create a collection with whatever extensions you would like on Firefox for Android Beta
  2. Note the number and name in the collection URL
  3. In Firefox Nightly / Beta, go to Custom Add-on collection and input the number and name.
  4. Your extensions should now be installed!

It’s a major pain in the ass, but unfortunately it’s totally out of my hands. I have added some specific support for mobile, but it’s pretty much just enough to get it working as until Mozilla changes their policies my hands are pretty much tied. Also note that cross-browser syncing doesn’t work on mobile (again Mozilla), but it does work between games on the same browser. So for example if you made a save for TWC 2 on mobile, you could import that into TWC 3 (or the demo!) on mobile. I want to add export to/import from a file functionality so I can at least somewhat bypass that restriction of Firefox, so that might also happen in 1.6.1 (my numbering is extremely haphazard, sorry y’all).

Also real quick aside about TWC 2 saves: if you try to load a save from the end of TWC 2 into TWC 2, you can export on the page where it says “Unfortunately, this save was created […]” and that’s a valid import into the TWC 3 demo, just import immediately after the character creation is complete!

8 Likes

only a question so please no execution of poor me lol can we change the stats of our characters as well? make them better? and if yes, how? I’m a noob when it comes to things like that xD