Problems getting the new checkpoint system to restore player named saves- Could I use goto instead of gosub?

Hi everyone,

I’m trying to implement the new checkpoint save system. I want to allow players to name their saves.

I have followed the instructions given on this forum and the choice-script website and set the saves and restores up in a gosub.

*label save

*temp slot
Which slot do you want to save?
*fake_choice

  • #Slot 1: ${save_name_1}*
  •    *set slot 1*
    
  • #Slot 2: ${save_name_2}*
  •    *set slot 2*
    
  • #Slot 3: ${save_name_3}*
  •    *set slot 3*
    
  • #Cancel*
  •    *return*
    

What do you want to call your saved game?
*input_text save_name[slot]
*if slot = 1

  • save_checkpoint slot1
  • return
    *if slot = 2
  • save_checkpoint slot2
  • return
    *if slot = 3
  • save_checkpoint slot3
  • return

label load
if (reload)
choice
selectable_if (choice_saved_checkpoint_slot1) #Slot 1: ${save_name_1} restore_checkpoint slot1
selectable_if (choice_saved_checkpoint_slot2) #Slot 2: ${save_name_2}
restore_checkpoint slot2
selectable_if (choice_saved_checkpoint_slot3) #Slot 3: ${save_name_3}
*restore_checkpoint slot3
#Cancel
return
else

You have yet to save your game.
*return

The problem is, when a player dies I give them these options. This comes up as an error using quicktest- that a choice must end in a *goto to *finish.

*choice
#Reload an earlier save.
*gosub_scene savegame load
#Restart.
*ending

I am sure I’m missing something very basic- I didn’t think I should put a *goto under the *gosub line for fear that this would mess with the location of the restore point. I have no idea how the *restore_checkpoint command operates.

Any ideas on what I should do?

Many thanks to you all!

-sorry the formatting is a bit messed up, I didn’t know how it would show and put it all in italics to distinguish it- that’s why there’s all those excess asterisks all over the place :open_mouth:

Assuming your code works as intended when you playtest it, try using *fake_choice instead of the *choice for the reload/restart thing that’s throwing the error?

1 Like

@LiliArch

Thanks for the reply. The code works when saving and restoring a game so far (as much as I have tested)- but it doesn’t when I use the restart or reload choice, after a player dies (so usually the choice would be for saving or reloading with no restart option).

I’ll give the *fake_choice a go tomorrow- (bit late for me to start a new mission right now) and post how it goes.

@LiliArch And anyone who can help!

Hmm…

When using fake_choice a new problem appears and the code runs on to the choice below it (other ‘normal’ game choice).

I haven’t been the best with gosubs-

Could a solution be instead of this:

*choice
#Reload an earlier save.
*gosub_scene savegame load
#Restart.
*ending

I do this:

*choice
#Reload an earlier save.
*goto_scene savegame load
#Restart.
*ending

EDIT:

My question had evolved

If I formatted like this:

*choice
#Reload an earlier save.
*gosub_scene savegame load
*goto younghub
#Restart.
*ending

Then, if I choose the reload option, but cancel it, I will return to *label younghub

But, if I choose a restore point (from *gosub_scene savegame load), will I also go to *label younghub? Or does *restore_checkpoint ignore that bit?

Okay, I have instead decided to use pre-named checkpoints. This seems more manageable.

This thread can be closed.

yeah this had me also thinking a bit and honestly pre-named checkpoints like you said might be for the best, on the plus side you have more control over what gets saved and loaded

1 Like

@coal8

Yes, it just didn’t work out for me.

Making a game knowing that you’ll use the player-named checkpoints would be doable, but shoving it inside a game like mine, without neat chapters, seems very difficult.

What is helpful is that a player can still save over a pre-made checkpoint to keep the restore point up to date on their adventures. This seems a good fit for my game.

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.