Temporarily disable save function?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
ForeverAScone
Newbie
Posts: 22
Joined: Sat May 23, 2020 8:08 pm
Location: Under your bed
Contact:

Temporarily disable save function?

#1 Post by ForeverAScone »

Does anyone know a way to temporarily disable the save function? For example, I have a rpg-styled battle in my game and I don’t want the player to be able to save during the battle until it is over. Thank you :)
:D
Artist for hire!! Check out my post with details here!
viewtopic.php?f=61&t=65610
Portfolio here!
https://sprinklebara.crevado.com/artwork

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Temporarily disable save function?

#2 Post by gas »

Use a global variable at the start of the script, maybe called "can_save".

Code: Select all

default can_save = True
Set it to False at the start of the battle and back to True at the end of combat.

In the NAVIGATION screen, add a check to disable SAVE/LOAD screens.

Code: Select all

 action [ShowMenu("save"), SensitiveIf(can_save)]
Then, to be fully compliant, change what you reach with the right clicking just after start.

Code: Select all

label start:
    $ _game_menu = "preferences"
I dunno if the quick menu is there, if you had one during battle use the same check for the navigation screen to disable the save button.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
ForeverAScone
Newbie
Posts: 22
Joined: Sat May 23, 2020 8:08 pm
Location: Under your bed
Contact:

Re: Temporarily disable save function?

#3 Post by ForeverAScone »

gas wrote: Sat May 30, 2020 7:09 am Use a global variable at the start of the script, maybe called "can_save"...
Hi, thanks for the response (even though I'm a month late at getting back to it lol >_<) I keep getting this error message:

Code: Select all

File "game/screens.rpy", line 291: expected statement.
    action [ShowMenu("save"), SensitiveIf(can_save)]
                                                    ^

Ren'Py Version: Ren'Py 7.3.5.606
Fri Jul 10 16:15:19 2020
I'm not really sure where to put that line within the navigation section.
:D
Artist for hire!! Check out my post with details here!
viewtopic.php?f=61&t=65610
Portfolio here!
https://sprinklebara.crevado.com/artwork

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Temporarily disable save function?

#4 Post by rayminator »

can you post the full error code

User avatar
ForeverAScone
Newbie
Posts: 22
Joined: Sat May 23, 2020 8:08 pm
Location: Under your bed
Contact:

Re: Temporarily disable save function?

#5 Post by ForeverAScone »

rayminator wrote: Sat Jul 11, 2020 12:08 am can you post the full error code
That is the full error code. I only got rid of "I'm sorry, but errors were detected in your script. Please correct the errors listed below, and try again."
But here it is again if you want it.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.

File "game/screens.rpy", line 291: expected statement.
    action [ShowMenu("save"), SensitiveIf(can_save)]
                                                    ^

Ren'Py Version: Ren'Py 7.3.5.606
Fri Jul 10 16:15:19 2020
:D
Artist for hire!! Check out my post with details here!
viewtopic.php?f=61&t=65610
Portfolio here!
https://sprinklebara.crevado.com/artwork

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Temporarily disable save function?

#6 Post by rayminator »

do you see a traceback.txt or log.txt the traceback here if you do see it error.txt only give some info

what are put the action [ShowMenu("save"), SensitiveIf(can_save)] (whish they have the in-line bbcode) to textbutton/imagebutton??
what's the full code for it?

User avatar
ForeverAScone
Newbie
Posts: 22
Joined: Sat May 23, 2020 8:08 pm
Location: Under your bed
Contact:

Re: Temporarily disable save function?

#7 Post by ForeverAScone »

rayminator wrote: Sat Jul 11, 2020 5:17 pm do you see a traceback.txt or log.txt the traceback here if you do see it error.txt only give some info

what are put the action [ShowMenu("save"), SensitiveIf(can_save)] (whish they have the in-line bbcode) to textbutton/imagebutton??
what's the full code for it?
You mean you want to see the full traceback code? For some reason this error is not showing up in log.txt or traceback.txt. I'm not really sure what you mean by the your question about the textbutton/imagebutton, sorry
:D
Artist for hire!! Check out my post with details here!
viewtopic.php?f=61&t=65610
Portfolio here!
https://sprinklebara.crevado.com/artwork

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Temporarily disable save function?

#8 Post by rayminator »

you have to put the action in a textbutton


something like this you can't just have the action only you need something before it

Code: Select all

textbutton _("Save") action [ShowMenu("save"), SensitiveIf(can_save)]

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Temporarily disable save function?

#9 Post by RicharDann »

gas wrote: Sat May 30, 2020 7:09 am Then, to be fully compliant, change what you reach with the right clicking just after start.

Code: Select all

label start:
    $ _game_menu = "preferences"
I tried this too but oddly it doesn't seem to work. The textbutton is disabled properly in navigation and quick menu screen, using the method you mentioned with can_save global variable, but right-clicking keeps sending me straight to the save screen. Tried using define and default too before labels, none of them worked. Is there another solution?

EDIT: Found it, seems the variable's name was changed to _game_menu_screen.

Code: Select all

label start:
    $ _game_menu_screen = "preferences"
Now it works as intended.
The most important step is always the next one.

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]