I’m trying to make a simple save system, that saves a checkpoint at the start of each chapter, which can then be loaded from the Stats screen.
I’ve run into the following issue when trying to load:
*redirect_scene is supposed to work like *goto_scene, but from the Stats Screen (copypasted from here)
*redirect_scene: This command behaves kinda like *goto_scene, but you can only use it on the stats screen. On the stats screen, the game is in “stats mode,” and so the button at the top of the screen says “Return to the game” instead of “Stats.” Stats mode is like the Matrix; it’s not the real world. In stats mode, *goto_scene stays in stats mode, and it doesn’t affect the main game. If you “Return to the game,” you’ll be right back in “game mode” in the chapter where you left off, like waking from a dream. Use *redirect_scene on the stats screen to *goto_scene in the main game.
It appears to work fine, only until you go to then exit the Stats Screen again, at which point you will return to whichever screen you were on when *redirect_scene was executed.
The code in the Stats Screen looks like this:
*choice
#Load last checkpoint.
[i]This will restart the current chapter. Continue?[/i]
*choice
#Yes.
*redirect_scene _load
#No.
*goto stats
The _load scene replaces variables with previously saved data:
I just need to know if I’m doing something wrong/have misunderstood how *redirect_scene should be used, or if it is indeed bugged out and I just need to stop wasting my time trying to make it work.
I didn’t even knew that command existed, but as far as I can see it works this way.
When you are playing the game and go to the stats page, the game remembers on which page you were and saves it, let’s say in “box 1”.
Once you are on the stat screen you can use the *redirect_scene and it’ll take you to the scene and you will be able to do whatever the scene prompts you. but the “box1” won’t be modified, like the explanation says, you are still “inside” the stats page like in the “matrix”. And if you enter the stats again and click on “return to the game” it will load the scene that saved last time in the “box 1”
I’ve implemented a save method but you can only access it when for example you die, and you can choose whether to restart the game from 0, or load the last checkpoint, but as I said, you can’t do it anywhere on the book. I don’t think it’s possible to implement a save system that works from inside the stats page.
What occurs to me but I have no idea if it’ll give you the same problem, is to use *goto_scene from the stats page, and on a separate scene you put the choice to restart from the checkpoint. But I don’t have much hope it works that way either. Try and let me know.
Hi, thanks for replying, but the thing is, I do think *redirect_scene was supposed to let you overwrite your “position” in the game, judging by Dan Fabulich’s posts here and here.
Unfortunately, I already tried adding labels in the *redirect_scene and *goto_scene. It still reverts to the old in-game “position” whenever I go to the Stats Screen.
Or do you mean something else by naming the chapter/scene?
I did try using @cup_half_empty’s save system but I couldn’t manage to make it work.
Does it allow you to successfully “load” from the Stats Screen (ie. doesn’t go back to the previous position as soon as you open/exit the Stats Screen)?
Use *redirect_scene in stats screen to transfer to the new scene.
Then it should work.
But it has a Con that is, you can’t cancel the scene once you enter it from stats screen (without the entering and exiting stats screen trick) as there is no command to re-enter stats mode.
Yeah, I can load from the stat screen using that system, my biggest issue is that quicktest has an error towards the end, still looking how to resolve that.
Hi, I managed to make your save system work (it wasn’t that complicated in the end), but I’m running into the same exact issue as described above. If you load from the Stats Screen, returning to that screen will return you to the original position in-game.
Maybe.
I run it either through ChoiceScript IDE (version 1.3.1), or on DashingDon’s hosting site.
Not sure which version of ChoiceScript they are running.
Edit: At least I’m not the only one running into this issue with *redirect_scene:
I agree that this happens on Dashingdon and in ChoiceScript IDE, but I fixed that bug two years ago, in 2020, in the official version of ChoiceScript on Github. It doesn’t reproduce when I use run-server.bat locally.
I’m a bit surprised that Dashingdon and ChoiceScript IDE are that far out of date!
Now you have two different variables for each stat.
When beginning a chapter, you want to save the character’s current stats so that you can restore them if you “load” your checkpoint. I recommend making a subroutine scene for this, unless you want to paste the same chunk of code at the start of every chapter.
*comment this is at the start of every chapter
*gosub_scene Routines save_checkpoint
*comment this is in the “Routines” scene
*label save_checkpoint
*set health_save health
*set magic_skill_save magic_skill
*set sword_skill_save sword_skill
*set agility_skill_save agility_skill
*set strength_skill_save strength_skill
*set money_save money
*return
This code takes your “save” variables and makes them mirror your “actual” variables at that point in the game.
Now, lets say you want to load to the checkpoint and reset the skills/variables to what they were at the start of the chapter?
*comment this is wherever you want to be able to load your checkpoint
*choice
#Load Checkpoint
*gosub_scene Routines load_checkpoint
*goto beginning_of_the_chapter
#End Game
*finish
*comment this is in the “Routines” scene
*label load_checkpoint
*set health health_save
*set magic_skill magic_skill_save
*set sword_skill sword_skill_save
*set agility_skill agility_skill_save
*set strength_skill strength_skill_save
*set money money_save
*return
Bing bam boom, your skills’ values are reverted to what they were when you saved them (in your case, at the start of every chapter).