Creating a Tooltip Example? [SOLVED]

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
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Creating a Tooltip Example? [SOLVED]

#1 Post by Katy133 »

I've been trying to create a "tooltip" screen by copying this example and pasting it into the screens file:

Code: Select all

screen tooltip_example():
    
    vbox:
        textbutton "North":
            action Return("n")
            tooltip "To meet a polar bear."

        textbutton "South":
            action Return("s")
            tooltip "All the way to the tropics."

        textbutton "East":
            action Return("e")
            tooltip "So we can embrace the dawn."

        textbutton "West":
            action Return("w")
            tooltip "Where to go to see the best sunsets."

        $ tooltip = GetTooltip()

        if tooltip:
            text "[tooltip]"
However, when I try to open the game, I get this message:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 1486: u'tooltip' is not a keyword argument or valid child for the textbutton statement.
    tooltip "To meet a polar bear."
           ^

Ren'Py Version: Ren'Py 6.99.13.2919
I'm trying to create an example tooltip display just to test out what it looks like. I've never made one before, and have never seen in-game screenshots of what Ren'Py tooltips look like, so I don't know how this tooltip tutorial manifests in a Ren'Py game.
Last edited by Katy133 on Sun Mar 04, 2018 2:51 pm, edited 1 time in total.
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Creating a Tooltip Example?

#2 Post by philat »

I would expect you don't have the latest update. That's a very recent addition to renpy.

User avatar
Katy133
Miko-Class Veteran
Posts: 704
Joined: Sat Nov 16, 2013 1:21 pm
Completed: Eight Sweets, The Heart of Tales, [redacted] Life, Must Love Jaws, A Tune at the End of the World, Three Guys That Paint, The Journey of Ignorance, Portal 2.5.
Projects: The Butler Detective
Tumblr: katy-133
Deviantart: Katy133
Soundcloud: Katy133
itch: katy133
Location: Canada
Contact:

Re: Creating a Tooltip Example?

#3 Post by Katy133 »

philat wrote: Sat Mar 03, 2018 11:47 pm I would expect you don't have the latest update. That's a very recent addition to renpy.
Thank you! Updating Ren'Py worked. :D
For those interested in the updated Tooltip feature, you'll also need to add a button/route to display the screen. I used a Quick Menu button for this example.

Code: Select all

screen quick_menu():

    ## Ensure this appears on top of other screens.
    zorder 100

    if quick_menu:

        hbox:
            style_prefix "quick"

            xalign 0.5
            yalign 1.0

            textbutton _("Back") action Rollback()
            textbutton _("History") action ShowMenu('history')
            textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
            textbutton _("Auto") action Preference("auto-forward", "toggle")
            textbutton _("Save") action ShowMenu('save')
            textbutton _("Q.Save") action QuickSave()
            textbutton _("Q.Load") action QuickLoad()
            textbutton _("Prefs") action ShowMenu('preferences')
            #Tooltip edit:
            textbutton _("Tooltip") action ShowMenu('tooltip_example')
Basically, when you press the Tooltip Quick Menu button, the different textbuttons ("North," "South," "East," "West"). Mousing over them shows the tooltip text ("To meet a polar bear," etc), and clicking a textbutton performs the action (Return).
ImageImage

My Website, which lists my visual novels.
Become a patron on my Patreon!

Post Reply

Who is online

Users browsing this forum: No registered users