Notification on choice buttons

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
Adamozo
Newbie
Posts: 1
Joined: Wed Jul 17, 2019 4:34 am
Contact:

Notification on choice buttons

#1 Post by Adamozo »

Hello.
I'm sort of new to Ren'Py.

So I've been trying to make a game for a friend of mine and I need a menu that would notify the player everytime he hovers over one of the items.
For example:

Code: Select all

menu:
    "Red":
        hovered Notify("This is red color.")
Something along those lines. But all I've been getting so far are errors that say:

Code: Select all

File "game/script.rpy", line 1131: expected statement.
    hovered Notify("This is not red.")
                  ^
Is there a simple way to make menu choices notify the player while they hover over them?

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: Notification on choice buttons

#2 Post by Remix »

You could alter the choice screen to support arguments, then add them in menus:

Code: Select all

# screens.rpy

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption:
                action i.action
                if i.args:
                    hovered Notify(i.args[0])
Then in menus, pass in an argument:

Code: Select all

label start:

    menu:
        "choice" ("this is a choice"):
            pass
        "choice 2" ("this is choice number 2"):
            pass
        "choice 3 with no notify":
            pass
Frameworks & Scriptlets:

Post Reply

Who is online

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