Issues with custom history screen including rollback

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
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Issues with custom history screen including rollback

#1 Post by SuperbowserX »

I have a custom history screen that is showed by a button that is always on the screen.

Code: Select all

...
imagebutton auto "ui/%s_dialogue.png" action Call("show_history")

label show_history:
    $ config.rollback_enabled = False
    $ quick_menu = False
    window hide
    with Dissolve(0.125)

    call screen history with Dissolve(0.125)

    $ quick_menu = True
    window show 
    with Dissolve(0.125)
    $ config.rollback_enabled = True
    return

screen history():
    tag menu
    predict False
    modal True
    
    vbox:
        *code for generating frame with history here...*
    
        button:
            action Return()
            background "#FFF"
            text "{color=#000}Click here to return to the game."
            xsize 1100
I am intentionally blocking rollback while in the history window, because if the user mousescrolls while the cursor is outside of the window, it will cause rollback to trigger and in turn the history window to exit. So that's working. But, I am having two issues with this.

1) Instructions to show the screen (calls to the show history screen) are being logged into the rollback feature. So if I rollback after opening and then closing history, I am going to get stuck in the history window and unable to roll back further behind that call. Is there anyway I can prevent calls to the show_history label from being factored into the rollback? Basically make rollback only register dialogue statements (none of which are inside the history label)?

2) For some reason, after I exit the history window, the text automatically progresses from the line it was on before I opened it to the one afterwards. I tested setting the imagebutton action to NullAction() and it wasn't happening there. Any ideas what's causing this?

Thanks!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Issues with custom history screen including rollback

#2 Post by Imperf3kt »

Why not make your history screen modal?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: Issues with custom history screen including rollback

#3 Post by SuperbowserX »

It was :)

Anyway, I managed to work out a solution. In my imagebutton, rather than make an action to call a label, I simply made a sequence of actions that first disabled rollback, then hid the quick menu, then show the history screen. Then, the history screen's return action was also a sequence of actions that did the exact opposite instructions of the imagebutton (re-enable those variables).

It's solved both problems. I'm no longer getting stuck in history on the rollback.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]