[Solved... ish?] A way to track replays?

Hi there! I’m in the process of learning choicescript, and I’m wondering though if it’s possible to create a sort of replay tracking system with Choicescript? So that if a player starts the game over, there’s flavour text or something, or maybe entirely new scenes that unlock only with replays?

I keep thinking perhaps it’s possible to do this through achievement setting, so like say a player receives an achievement of playing the game once, and on the second playthrough, there’s an *if statement that checks if it’s been achieved, and then the flavour text’ll pop up? Is this possible?

Or is there any other sort of way replays can be tracked? I just think it’d be a really fun mechanic to have! :^)

Also, I apologize in advance if this has been asked before! I tried searching for similar questions, but I couldn’t find any…

[Sorta solved, until someone comes up with a more efficient tracking method!]

Check Achievements Method Solution

This is a working sample test I tried using *check_achievements as suggested by @MizArtist33!

This is a test on whether you can track replays.
*fake_choice
	#I think I can.
	#Maybe.
	#Idk.
		
Well, let's see. 

*check_achievements
*if ((choice_achieved_complete1 and choice_achieved_complete2) and choice_achieved_complete3)
	*goto youfinishedmultipletimes
*elseif (choice_achieved_complete1 and choice_achieved_complete2)
	*goto youcompletedthis2
*elseif (choice_achieved_complete1)
	*goto youcompletedthis1
*else
	*goto youfinished

*label youcompletedthis1
*page_break
You completed the game once!
*goto youfinished

*label youcompletedthis2
*page_break
You completed the game twice!
*goto youfinished

*label youfinishedmultipletimes
*page_break
You finished multiple times!
*goto youfinished

*label youfinished
*page_break
You finished!


*check_achievements
*if (choice_achieved_complete1 and choice_achieved_complete2)
	*achieve complete3
	*finish
*elseif (choice_achieved_complete1)
	*achieve complete2
	*finish
*else
	*achieve complete1
	*finish

*finish
4 Likes

My understanding is that one of the more reliable ways you can do this is through tracking achievements, as they carry over through multiple playthroughs (unless the game is redownloaded or played through another platform, of course).

1 Like

The achievement method is probably the most elegant way to do it.

You could also use a password system, so that players are given a password that they can enter at the start of a new game which unlocks certain content.

2 Likes

Okay–I’ve run a few tests, and it seems like *check_achievements only seems to work when you’d like to award other achievements. It doesn’t seem to work with *goto statements. Unless I’m doing this all wrong, somehow, haha.

Here’s the test I did on CSIDE:

That’s an intriguing notion! Thank you for sharing it–but I think I’m looking for a more “discreet” way of inserting flavour text for multiple playthroughs.

Well, if those checks fail, you’ll be falling through anyway.

*achievement test_achieve visible 10 Bla bla bla
    bla bla bla bla

*check_achievements
Pick an action
*choice
    *if (choice_achieved_test_achieve = false) #Achieve
        *achieve test_achieve
        *finish
    #Finish
        *finish

Seems to work as I’d expect it to.

2 Likes

Hey–thanks for this! It really helped in me figuring out how to do it. Looks like I’ve been getting my *ifs and *elseifs all wrong! Looks like I still need a lot of practice.

I managed to get this working, for anyone else who wants to test it out!

This is a test on whether you can track replays.
*fake_choice
	#I think I can.
	#Maybe.
	#Idk.
		
Well, let's see. 

*check_achievements
*if ((choice_achieved_complete1 and choice_achieved_complete2) and choice_achieved_complete3)
	*goto youfinishedmultipletimes
*elseif (choice_achieved_complete1 and choice_achieved_complete2)
	*goto youcompletedthis2
*elseif (choice_achieved_complete1)
	*goto youcompletedthis1
*else
	*goto youfinished

*label youcompletedthis1
*page_break
You completed the game once!
*goto youfinished

*label youcompletedthis2
*page_break
You completed the game twice!
*goto youfinished

*label youfinishedmultipletimes
*page_break
You finished multiple times!
*goto youfinished

*label youfinished
*page_break
You finished!


*check_achievements
*if (choice_achieved_complete1 and choice_achieved_complete2)
	*achieve complete3
	*finish
*elseif (choice_achieved_complete1)
	*achieve complete2
	*finish
*else
	*achieve complete1
	*finish

*finish

I think in theory you can go a long way with how many times you want to track replays–but I got dizzy after the third achievement LOL.

If anyone has any other efficient way, please post away! This is the only way I can think of so far, but I’d be grateful if there are any alternatives!

4 Likes

Looks like you got it figured out before I was able to check back in! Awesome.

Haha, yeah, the more layers/branching/variable you throw in there, the more complicated it gets. I guess the only other friendly advice I’d give is make sure the impact on the story is commensurate with the work you feel you’re putting into it and that it’s totally okay to keep things manageable for yourself. Good luck!!! :grin:

2 Likes

You can only achieve complete3 once you have complete2 (which you can only achieve once you have complete1). So, choice_achieved_complete1 and choice_achieved_complete2 are implied.

Based off of yours, how about:

*comment very first scene

*label one
*check_achievements
*if (choice_achieved_complete3)
	You have completed the game many times.
	*goto two
*if (choice_achieved_complete2)
	You have completed the game twice.
	*goto two
*if (choice_achieved_complete1)
	You have completed the game once.
	*goto two

*label two
Well done!

*finish

They have to be checked for in descending order, though, or else it won’t work as intended.


I would imagine the final chapter would have something like this in it:

*comment very last scene

*label three
*check_achievements
*if not(choice_achieved_complete1)
	*achieve complete1
*if ((choice_achieved_complete1) and not(choice_achieved_complete2))
	*achieve complete2
*if ((choice_achieved_complete2) and not(choice_achieved_complete3))
	*achieve complete3

*ending

And so on, if you want to check for more specific numbers.

1 Like

This looks so much more code efficient! I’ll give it a whirl on CSIDE in a bit and then update–but thank you so much!

2 Likes

No problem! It’s a cool idea, so I might have to use it myself…

You could just write a fake ending page (instead of real *ending) where the choice to play again SETS a variable.

Then just add *if trip_set true for your flavory bits :ice_cream:

1 Like

Oh yes! I recently saw that being used in Caves and Dinosaurs… and also a Choice of Games title, though I can’t, for the life of me, remember which. I think it had something to do with demons, or fantasy creatures of some kind. Thank you so much for the suggestion!

1 Like

If you want different flavors for different # of replays, make that variable you’re setting is a number (*set no_of_replays +1) not true/false.

Otherwise, it’s easier to do a true/false variable.

1 Like