Roll-forward issues, losing "status" of buttons and screens.

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
ISAWHIM
Veteran
Posts: 318
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Roll-forward issues, losing "status" of buttons and screens.

#1 Post by ISAWHIM »

Roll forward = (Roll mouse-wheel down) {Returning back to the current point where you rolled back from}
Roll backwards = (Roll mouse-wheel up) {Going back in dialogue/play}

Which is actually the reverse of what you would imagine it would do... But I can change that, if it actually worked correctly, for anything other than standard dialogue and choices.

I am trying to retain the ability to "roll forward" after "rolling back", but these are the issues I am having.

Many "states" of things are being "thrown-out", after rolling-back, so when rolling-forward, the game is not returning back to the present state. But when rolling back, they are at-least half correct. :P

For example, I am using imagebuttons tied to a "MoveMe" function, to move the player from room to room, and update the screen.

When I roll-backwards, the button "selected" state correctly displays, but the associated screen and character location does not change.

Then, when rolling forward, RenPy seems to have forgotten the button states. The "selected button" remains where it was, while the player does too, which are not the same locations. It also refuses to change screens, reverting back to the default button screen, on rolling-back, no matter where you are. (The screens are all the same tag, so one replaces the other, depending on the area you are in.)

Additionally, when hitting a python-version of the RenPy code for a menu (choices), it loses the ability to roll-back, completely, until a selection is made. (Which actually crashes the program, because after a selection is made, the "choice" is removed from the stack of choices, so it no longer exists in Python-code.) The choices are constructed from available actions, retained in standard python variables. I remove them, once completed, from the LIST of DICTs, so they don't have to be iterated through, to make display faster and free-up memory. The whole LIST of DICTs, is created at "init python:", which will eventually be a massive list of quests and events data. (This is NOT a "CLASS", as much as it looks like one. :P )

Code: Select all

label e2:
    init python:
        EVNT.update({
        "e2":{
            "active":True,
            "days":[None],
            "time":[{"hour":None,"minute":None},{"hour":None,"minute":None}],
            "locations":[None],
            "actions":[None],
            "with":[None],
            "sleep":None,
            "minmax":[1,1],
            "count":0,
            "question":None,
            "choices":[None]}
            })
    "Yes, you got to e2!"
    $ del EVNT["e2"]
    $ fTimeChange(15)
    jump TimeLoop
I suppose I could just purge the data in the DICT, and that would still make it "exist". But that will not change the fact that the data is not there, after a roll-back, after the "$ del EVNT["e2"]" statement, if it is changed to a purge of the data. It would roll forward with the same error, about the data not existing, to iterate through.

So, how can I get the actual roll-back function to work as desired.

Should I just create my own "replay"? Somehow recording anything that changes, in a list, and then cycle through that. Only clearing the history, when a change is actually made, when moving forward again?

I can't even figure-out how to get imagebuttons to be "set as selected", using python code. They are created in screens.rpy, and don't have any kind of unique identifier, except possibly the images used. I currently have the button, itself, set it's own state to "selected", when the user selects it. (Which is obviously failing to roll-forward correctly, even though it is all RenPy code here, controlling the buttons and values.)

Code: Select all

# Default starting values, needed for screen-buttons
# These are renpy values, which don't roll forward, only rolling backwards...
# They "forget" what they were, when rolling forward.
define groupLocA = 7
define groupLocB = 0

screen sideNavA:
    zorder 10
    tag nav
    fixed:
        imagebutton auto "btn/loc home %s.jpg" xpos 1564 ypos 210 action [Show("sideNavB"), Function(fSetChrLocations)]
        imagebutton auto "btn/loc yourbedroom %s.jpg" xpos 1564 ypos 318 action [SetVariable("groupLocA", 1), SelectedIf(groupLocA == 1), SetVariable("groupLocB", 0), Function(fMoveTo, "yourbedroom"), Jump("TimeLoop")]
        imagebutton auto "btn/loc sparebedroom %s.jpg" xpos 1564 ypos 426 action [SetVariable("groupLocA", 2), SelectedIf(groupLocA == 2), SetVariable("groupLocB", 0), Function(fMoveTo, "sparebedroom"), Jump("TimeLoop")]
        imagebutton auto "btn/loc masterbedroom %s.jpg" xpos 1564 ypos 534 action [SetVariable("groupLocA", 3), SelectedIf(groupLocA == 3), SetVariable("groupLocB", 0), Function(fMoveTo, "masterbedroom"), Jump("TimeLoop")]
        imagebutton auto "btn/loc bathroom %s.jpg" xpos 1564 ypos 642 action [SetVariable("groupLocA", 4), SelectedIf(groupLocA == 4), SetVariable("groupLocB", 0), Function(fMoveTo, "bathroom"), Jump("TimeLoop")]
        imagebutton auto "btn/loc lounge %s.jpg" xpos 1564 ypos 750 action [SetVariable("groupLocA", 5), SelectedIf(groupLocA == 5), SetVariable("groupLocB", 0), Function(fMoveTo, "lounge"), Jump("TimeLoop")]
        imagebutton auto "btn/loc terrace %s.jpg" xpos 1564 ypos 858 action [SetVariable("groupLocA", 6), SelectedIf(groupLocA == 6), SetVariable("groupLocB", 0), Function(fMoveTo, "terrace"), Jump("TimeLoop")]
        imagebutton auto "btn/loc poolyard %s.jpg" xpos 1564 ypos 966 action [SetVariable("groupLocA", 7), SelectedIf(groupLocA == 7), SetVariable("groupLocB", 0), Function(fMoveTo, "poolyard"), Jump("TimeLoop")]

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Ocelot, snotwurm