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.
A lot of the code resources i'm finding are pretty outdated and unreliable. how would one go about hiding JUST the back button? (And + possible an option for it to only be hidden in distributions like how developer mode being set to auto only disables it in distributions?? Not sure if thats an option if not i could work around it but.)
edit: alternatively, is there a way to make the back button have a limit of how many lines of dialogue it can go back on? I want people to be able to have the opportunity to go back and read something if they accidentally clicked too fast but i want to avoid letting people go a huge way back and choose a different route.
You likely want fixed rollback...
A setting whereby:
They can rollback as normal, just if they go past a choice menu they cannot choose a different option...
This doesn't actually work, even though I thought it would...
label start:
python:
if not config.developer:
renpy.fix_rollback()
"Game starts here... rollback allowed... different choices in rollback disabled for non developer mode"
A workaround that does work by setting the toggle on every line basically...
init python:
def set_rollback(*args, **kwargs):
renpy.game.log.rollback_is_fixed = True
config.all_character_callbacks.append( set_rollback )
label start:
"Start - if you rollback to here it will reset btw"
"Pre-menu"
menu:
"1":
"yay"
"2":
"umm"
"End"
return
Still unsure why we cannot just set " renpy.game.log.rollback_is_fixed = True " once and have it run throughout the whole game... Maybe have a play around
P.S. You could add the " if not config.developer: " conditional in the function if you want
init python:
def set_rollback_after_menu(mode, old_modes):
if len(old_modes) \
and old_modes[0] in ['menu', 'nvl_menu']:
renpy.game.log.rollback_is_fixed = True
if not config.developer: # only do if not developer
config.mode_callbacks.append( set_rollback_after_menu )
label start:
"Start - if you rollback to here it will reset btw"
"Pre-menu"
menu:
"1":
"yay"
"2":
"umm"
"End"
return
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/screens.rpy", line 99: expected statement.
textbutton _("Back") action Rollback()
^
Ren'Py Version: Ren'Py 6.99.14.1.3218
Sat Feb 24 19:54:45 2018
Given the line number I'm guessing you added that line somewhere outside of the actual screen. If you just want to disable the button, find the line textbutton_("Back") action Rollback() in screens.rpy, under screen quick_menu(): and change it to add the if statement:
if config.developer:
textbutton_("Back") action Rollback()
This will not prevent rollback though, as the player would still be able to use other bindings (e.g. the mousewheel) to rollback. As has been mentioned you should use fixed rollback for important choices if you don't want players to rollback and choose a different option.
irredeemable wrote: ↑Sat Feb 24, 2018 10:17 pm
This will not prevent rollback though, as the player would still be able to use other bindings (e.g. the mousewheel) to rollback. As has been mentioned you should use fixed rollback for important choices if you don't want players to rollback and choose a different option.
Just remember (as stated) that hiding or disabling the button does not alter the facility...
Rollback = button click OR page up keypress OR mousewheel up OR hover left side of window (mostly android iirc) OR ...