That actually almost works today with the *check_achievements
command. This command creates temp variables named “choice_achieved_dragonslayer”, which you can use to detect whether the player has previously reached an achievement. You can use this in a few different ways.
Repeated achievements: Each time you call *achieve
, a banner will appear to indicate that the player has earned the achievement. If the player reaches the same achievement multiple times, the banner will display each time.
If you want to prevent the banner from appearing multiple times, then you can do it like this:
*check_achievements
*if not(choice_achieved_dragonslayer)
*achieve dragonslayer
Meta achievements: These are achievements that you achieve by achieving other achievements. They’re annoying to code, but they do work:
*check_achievements
*if ((choice_achieved_dragonslayer and choice_achieved_lover) and choice_achieved_secret)
*achieve dragonmaster
Free purchases: You can give the player free IAP for playing well by assigning the player an achievement.
*check_achievements
*check_purchases
*if choice_purchased_goggles or choice_achieved_goggles
You have the goggles! They're super effective!
But there’s a big caveat. Part of the reason there isn’t more public documentation about ChoiceScript achievements is that there isn’t a very reliable way of making sure that they stick around. On iOS and Steam, Apple and Valve provide official mechanisms for registering achievements that stay achieved. On Android and Chrome Web Store, the user installs the app, so as long as the app remains installed, the achievement stays unlocked. But on the web, it’s very easy to lose your achievements (e.g. if you clear cookies and local storage).
If we host the game on choiceofgames.com, we can try to take care of this for you, but not just anybody can put a game up on their website and have reliable working achievements.
At some point, I’d like to set up some code and instructions allowing players to register their games with Google Play Game Services, in which case Google will store your players’ achievements (but they’d still have to login first).
For now, it’s not totally possible/reliable to create a truly “permanent” boolean.