Making text appear when you hover over a choice?

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
Rudje
Newbie
Posts: 7
Joined: Mon Oct 23, 2017 8:11 am
Projects: False God's Apocalypse
Tumblr: afancyartblerg
Deviantart: venusrain
Soundcloud: ClyncyeRudje
itch: ClyncyeRudje
Contact:

Making text appear when you hover over a choice?

#1 Post by Rudje »

Is there a way to make a "pop up" (probably not the term I want, but...) appear when you hover over a choice? I'm making a fan VN for FFV and that's the method i want to implement for warnings/information about a given story since the "paths" are all just distinct stories with fairly different tones. Worse comes to worst I can implement the warnings as a a choice within a choice, but I'd rather try something more elegant and less intrusive.

I searched, but couldn't find anything (probably because I'm not using the right terminology because it seems like something that would have come up before).

As an example of what I'm trying to do, at the start of the game you get a bunch of choices, and hovering over those choices displays text in a box that says stuff along the lines of "Characters: Bartz, Galuf, Lenna, Faris, Mood: Saturday morning cartoon, Content warnings: character death, meatfort". Something like that. I can make a mock-up if needed.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Making text appear when you hover over a choice?

#2 Post by xavimat »

Go to screens.rpy and change the screen choice with this one:

Code: Select all

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            if '|' in i.caption:
                $ i1 = i.caption.split('|')[0]
                $ i2 = i.caption.split('|')[1]
                textbutton i1 action i.action tooltip i2
            else:
                textbutton i.caption action i.action

    $ tooltip = GetTooltip()

    if tooltip:
        frame:
            align (.9,.8)
            text tooltip
You can use it adding the | character as separator in menu choices.

Code: Select all

label start:
    menu:
        "Path 1|Characters: Lenna, Faris\nMood: Saturday morning cartoon\nContent warnings: character death":
            pass
        "Path 2|Characters: Bartz, Galuf\nMood: Sunday evening cartoon\nContent warnings: sugarcandy":
            pass
        "A path without tooltip":
            pass[/choice]
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Rudje
Newbie
Posts: 7
Joined: Mon Oct 23, 2017 8:11 am
Projects: False God's Apocalypse
Tumblr: afancyartblerg
Deviantart: venusrain
Soundcloud: ClyncyeRudje
itch: ClyncyeRudje
Contact:

Re: Making text appear when you hover over a choice?

#3 Post by Rudje »

Thank you! Do I replace everything under choice or just the first section? e: Nevermind, figured it out. Thank you again, this helps a ton!
Last edited by Rudje on Sat Jul 21, 2018 6:44 pm, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Making text appear when you hover over a choice?

#4 Post by xavimat »

Rudje wrote: Sat Jul 21, 2018 6:27 pm Thank you! Do I replace everything under choice or just the first section?
Only the screen choice itself (the original is pretty short actually, six lines, one of which is empty).
The lines after the screen are definitions and styles. They affect the screen but are not not part of the screen itself.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Google [Bot]