New in ChoiceScript: HTML Exports, Checkpoints, and Achievements

ChoiceScript now includes an easy way to export your game to HTML, which, in turn allows us to make checkpoints and achievements available to all users of ChoiceScript.

Export to HTML with just two clicks

When you follow our ChoiceScript introduction, you’ll run the “ChoiceScript server,” which will make your game available in your browser, locally, just on your machine.

When you view a ChoiceScript game in your browser via that server, you’ll find a new “Export to HTML” link at the bottom of the page:

When you click it, ChoiceScript will convert your entire game into a single HTML file, and then say:

Export Complete!
Click here to download your compiled game.

When you click on that generated link, you’ll download an HTML file containing your game. You can double-click on it to play it immediately.

Even better, if your game includes an *ifid command, the exported HTML file will autosave your progress in the user’s browser. (And, if you don’t have an *ifid command, the exporter will generate one for you, which you can copy and paste into your startup.txt file.)

Read the documentation for the “Export to HTML” feature for additional details.

You might not need Dashingdon now

Once you’ve exported your game to HTML, you can that distribute that file to testers via email, Google Drive, Dropbox, or, best of all, as an attachment on our forum.

To upload HTML, drag your HTML file into your post. Like this!

My_First_ChoiceScript_Game.html (462.5 KB)

Players can download the attachment and double-click on it to play your game. (Try refreshing your browser tab, or closing and reopening it. You’ll keep all of your progress!)

It’s easier to find Quicktest and Randomtest, too

While I was in there, adding links, I added in links to Quicktest and Randomtest, making it easy for you to find and run the tests just by clicking the links.

Checkpoints

You probably saw the thread about this back in October, and, now, it’s finally here.

To save a checkpoint, you’d use:

*save_checkpoint

Then, later, you’d give players the option to restore to a previous checkpoint, like this:

*choice
    #Continue to the next chapter.
        *finish
    #Restore to the previous checkpoint.
        *restore_checkpoint

When you *restore_checkpoint, the player will “travel back through time” to the moment that *save_checkpoint was called. This includes re-enabling any *disable_reuse options that the player may have used after saving the checkpoint.

(Previously, if you wanted to implement checkpoints yourself, you’d have to use a *gosub_scene to individually copy all of your stats to separate “backup” variables, and then use another subroutine to individually copy all of your stats from the backup to the main variables. This was tedious and error prone.)

We’ve also added a “Tricks with Checkpoints” section to the “Advanced ChoiceScript” guide, with these tips and tricks:

  • Check whether *save_checkpoint has happened yet
  • Run some code after restoring from a checkpoint
  • Exclude some stats/temps from being restored
  • Multiple checkpoint “slots”
  • Restore to the last checkpoint at any time from the stats screen
  • Player-named save slots

Note that if you’re testing your game in the ChoiceScript server, when you refresh your browser tab, the entire game will reset from the beginning, losing all progress, including checkpoints and achievements, but when you export to HTML, all of that stuff will be saved.

Achievements

You can now define achievements using the *achievement command at the start of startup.txt, activate achievements using the *achieve command, and check which achievements the user has earned using the *check_achievements command.

Check out our new documentation page on “Achievements in ChoiceScript” for additional details.

ChoiceScript has had this achievements feature for many years, but we treated it as a “private” ChoiceScript feature, available only to authors publishing via Hosted Games, Choice of Games, or Heart’s Choice, because there was no good way to save any of the achievements that the player unlocked; whenever you’d close or refresh the browser tab, you’d lose all of your achievements.

But the “Export to HTML” feature now provides a way for any ChoiceScript author, even an unpublished author, to offer achievements that won’t disappear.

89 Likes

Hi Dan! I just checked the Choice of mods website and it says " an unexpected data base error has occurred" or something like that. Is the website okay?

1 Like

Isn’t that a piracy site?

8 Likes

Very cool! I was just looking into a checkpoint system as my WIP introduced more ways to die, perfect timing.

3 Likes

Wow, this is great!

I really enjoyed using achievements as a writer, and am already steepling my fingers menacingly over how to ratchet up the tension (without burning out readers and making them quit) with checkpoints.

As someone who writes and publishes short games elsewhere, as well as through Choice of Games, it’s really awesome to see you all working out ways that indie/self-published folks can take advantage of cool features!

13 Likes

Choice of Mods is not owned or controlled by us.

15 Likes

I don’t know how to do that. I am confused :confused:. I want to make a hacker choices games.

Try posting a question in the ChoiceScript Help category on the forum.

2 Likes

I’m thrilled - really looking forward to getting into using all this! Thanks for making it happen!

Can I also check whether it’s known if the checkpoint system is compatible with the ChoiceScriptSavePlugin?

10 Likes

This was much needed---- thank you.

Brilliant additions that I will absolutely be using, thank you so much. Great things are happening with ChoiceScript!

4 Likes

I’ve tried out making restores accessible from the stats screen, and giving a variety of available checkpoints to load to (ie being able to load to Chapter 1 or 2 at the end of Chapter 3); it worked great!

12 Likes

Thank you to the team who made Choicescript a whole lot more powerful! Especially the long-awaited checkpoint system. Looking forward to using them and seeing what additional new features are headed our way!

4 Likes

*save_checkpoint says that it is a “nonexistent command”. Please help?

If you’re using CSIDE or Dashingdon/Moody, the new commands aren’t compatible with them yet. If you’re just playtesting or automatically testing your own files, you may also need to download the most recent version of ChoiceScript.

Just tried that. Still gave me the error. The download bit I mean.

Nevermind I ran the wrong quicktest. Then ran the right one and ended up with a new error.

A post was split to a new topic: Missing “Export to HTML”

Can someone point me to instructions on how to update my current WIP to the newest version of Choicescript without TANKING everything I have already? TAT I’m kinda worried about bricking my game by accident doing something wrong.

I hope someone’s written a tutorial…

If you want to be extra safe:

  • Back up your scenes folder along with any image files you have in your game, and anything else that you might be editing that’s in your ChoiceScript folder.

  • Download the newest version of ChoiceScript.

  • Copy your files into scenes in the new ChoiceScript folder.

  • Copy everything into wherever you have your game saved (for me it’s a Dropbox folder).

If you’re exclusively using CSIDE, I believe it isn’t currently updated with the newest version of ChoiceScript so you may as well hang fire until it is.

5 Likes