Page 1 of 1

[Solved] Disable game progression until variable is set

Posted: Sat Mar 29, 2014 7:13 am
by Keul
Hello,

I've implemented a small notice message system and I'd like to block the game progression in she script while all notice message aren't read.
When all message are read, the unread variable is set to False (this part works).
The problem is that I'm in nvl_mode and I don't want to add dialog until unread is False, because that would fill screen with these dialogs.

$ renpy.pause() is hiding all the screen so it's not possible to read notices.
I was not able to call a screen to block progress (while leaving right part of screen available to read notices)

Re: Disable game progression until variable is set

Posted: Sat Mar 29, 2014 8:58 am
by Asceai
Does renpy.interact() work as an alternative to pause? I haven't used it myself.

In terms of calling a screen to block progress, try fiddling with the screen's zorder. If you throw up a screen modal and lower in zorder to the screens necessary to read notices, it should block all input those screens don't use.

Re: Disable game progression until variable is set

Posted: Sat Mar 29, 2014 12:49 pm
by Keul
renpy.interact() doesn't exist.
ui.interact() exist but it show an empty screen like renpy.pause()

And how can I add a screen when in a python function? seems that there's no renpy.show_screen("screenname")

Re: Disable game progression until variable is set

Posted: Sat Mar 29, 2014 4:04 pm
by Alex
Keul wrote:ui.interact() exist but it show an empty screen like renpy.pause()
Add

Code: Select all

window show
to your code to make say screen stay onscreen.


Try something like

Code: Select all

define e = Character('Eileen', color="#c8ffc8", kind=nvl)
define narrator = Character(None, kind=nvl)

transform my_transf:
    on show:
        alpha 0.0
        linear 0.5 alpha 1.0
        
    on hide:
        linear 0.5 alpha 0.0
        
screen notice_scr:
    timer 1.5 action [Hide("notice_scr"), Return("smth")]
    
    frame:
        align (0.5, 0.5)
        xmaximum 200 xminimum 200
        ymaximum 30 yminimum 30
        
        text "message seen"
        
        at my_transf
    on "show" action SetVariable("unread", False)
        
screen button_scr:
    textbutton "Notice" action If(renpy.get_screen("notice_scr"), None, Show("notice_scr")) xalign 1.0 yalign 0.05
    
    
# The game starts here.
label start:
    $ unread = False
    window show
    show screen button_scr
    
    e "You've created a new Ren'Py game."
    $ renpy.show_screen("notice_scr")
    e "???"
    
    $ unread = True
    "*and now you won\'t be able to advance through the text until you check the notice*{nw}"
    
    $ ui.interact()


    e "Once you add a story, pictures, and music, you can release it to the world!"

    return

Re: Disable game progression until variable is set

Posted: Wed Apr 02, 2014 4:39 pm
by Keul
Thank you.

I haven't used the same code but with the "window show" and "Return("smthing")" it works