Help writing a Messagebox/Alert dialog

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
docclox
Newbie
Posts: 20
Joined: Thu Oct 12, 2017 6:26 am
Contact:

Help writing a Messagebox/Alert dialog

#1 Post by docclox »

Is there an easy way of doing a popup message with an "OK" button or similar?

I tried writing my own.

Code: Select all

screen ahem(msg):
    modal True
    side 'c':
        vbox:
            text _("{b}Ahem!{/b}")
            text _(msg)
            textbutton _("Gotcha") action None
That's broken in a number of interesting ways. I know how to do frames and adding one will handle the no-background issue. The problem is that that the button doesn't click and I don't know what action to specify to make the button dismiss the screen.

I can probably do everything I need with images, and I don't suppose I'll do this a lot, but it would be nice to know how.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Help writing a Messagebox/Alert dialog

#2 Post by Remix »

action [ renpy.hide_screen( 'ahem' ) ]
or maybe
action [ Function( renpy.hide_screen, 'ahem' ) ]

For info, a button with None or NullAction will generally be insensitive, so clicking will do nothing
Frameworks & Scriptlets:

User avatar
docclox
Newbie
Posts: 20
Joined: Thu Oct 12, 2017 6:26 am
Contact:

Re: Help writing a Messagebox/Alert dialog

#3 Post by docclox »

Thanks, I'll try those.

(I figured that None as an action probably wasn't right. I just couldn't work out what was right :))

Post Reply

Who is online

Users browsing this forum: Bing [Bot]