Is *redirect_scene bugged?

Hello,

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:

*set playful s_playful
*set diplomatic s_diplomatic
*set timid s_timid
*set emotional s_emotional
*set pacifist s_pacifist
*set friendly s_friendly
*set involved s_involved
etc....

then restarts the current chapter (determined in separate _Save scene):

*if SavedChp = 2
    *goto_scene chapter02
*if SavedChp = 3
    *goto_scene chapter03
etc...

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.

Thank you! :slight_smile:

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.

3 Likes

Hmm, i don’t think that will work as even if you use *goto_scene you will still be in Stats mode.

But it could work, I am unable to verify so if it does please do let us know @Sofia_D

Hmm anothing thing that occured to me can you try *redirect_scene instead of *goto_scene in _Save

Had that issue recently as well. Talked about it in this thread

I think you need to tell where to go. For example, when I start the save system I use this:

*gosub_scene savesys save 1 "chapter12" "variables"

This line (and the softsave program) names the position where the save is from. Thhe chapter is “chapter12” and the first scene there is “variables”

Then in the stat screen I use this:

#I would like go back to the [b]last checkpoint[/b].
    *gosub_scene savesys load 1
    *redirect_scene {savesys_slot_1_scene} {savesys_slot_1_label}

The {savesys_slot_1_scene} is what was saved in the save (in this case chapter12) and the {savesys_slot_1_label} is the first label (variables)

So for the save in chapter 12, the redirect scene would actually look like this:

*redirect_scene chapter12 variables

And it would be different for every point you can save from.

Hoped that helped.

EDIT: In short, you need to name what chapter and what scene you go to when using *redirect_scene

7 Likes

Yes, I’m probably wrong, I was just guessing based on the output you showed. I think you have the answer already.

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)?

In any case, thank you for the help!

Ok I think i figured out a logic that can work,

  1. Create a new scene which just contains this
  1. 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.

1 Like

If you’re having trouble setting it up you can shoot me a message :grin: or ask in the thread itself, might help other people with the same questions.

Btw, the issue with quicktest should be fixed now.

1 Like

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.

I give up :smiling_face_with_tear:

1 Like

How are you running the game? It could be something with your version of ChoiceScript exactly. On my end it works fine.

1 Like

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:

You are absolutely right. There is a bug with *redirect_scene and the stats screen. Pulling you in, @dfabulich.

Steps to reproduce:

  1. At point_a, enter the stats screen and select to redirect to point_b.
  2. Enter the stats screen again and leave.
  3. You’ll be back to point_a, instead of point_b.

startup.txt

*scene_list
    scene_1

scene_1.txt

*label point_a
A

*page_break
*label point_b
B

choicescript_stats.txt

*fake_choice
    # Redirect to point_b
        *redirect_scene scene_1 point_b
2 Likes

I don’t reproduce that.

  • I made exactly the three files you suggested in ChoiceScript IDE for web.
  • I launched the game, and saw “A”.
  • I clicked “Show Stats” and saw the “Redirect to point_b” menu.
  • I clicked Next in the stats menu and saw “B” as expected.

I also tested it locally with Node using “run-server.bat”, and it worked as expected.

EDIT: Here’s a Dashingdon link with the code sample, which also works as expected. https://dashingdon.com/play/dfabulich/redirectscene-test/mygame/

1 Like

After you’re redirected to point B, go to the stats page again and leave immediately. You’ll be back to point A, instead of B.

1 Like

Ah, I understand.

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!

3 Likes

Well, I don’t know about *redirect_scene, but if you’re looking for an alternative “checkpoint” system here’s what I do:

First, you have all the stats you want to “save”. Then, you have a second set of stats to match those.

*create health 100
*create magic_skill 10
*create sword_skill 20
*create agility_skill 15
*create strength_skill 15
*create money 200

*create health_save 0
*create magic_skill_save 0
*create sword_skill_save 0
*create agility_skill_save 0
*create strength_skill_save 0
*create money_save 0

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).

That’s exactly what Softly does. :grin: It generates all the boilerplate for you.

1 Like

It’s a simple but effective system haha

Personally I just like doing all my code manually, but I can deff see the usefulness of your plugin!