[Solved] Disable game progression until variable is set

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
Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

[Solved] Disable game progression until variable is set

#1 Post 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)
Last edited by Keul on Wed Apr 02, 2014 4:39 pm, edited 1 time in total.

Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Disable game progression until variable is set

#2 Post 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.

Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

Re: Disable game progression until variable is set

#3 Post 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")

User avatar
Alex
Lemma-Class Veteran
Posts: 3098
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Disable game progression until variable is set

#4 Post 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

Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

Re: Disable game progression until variable is set

#5 Post by Keul »

Thank you.

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

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot]