How to Make Dialog Appear When Hovering in Map

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
maryeliezka
Newbie
Posts: 23
Joined: Sat Sep 10, 2011 4:26 am
Completed: The Ghost on The Shore
Projects: Project Helix
Organization: Project Helix Team
Contact:

How to Make Dialog Appear When Hovering in Map

#1 Post by maryeliezka »

I’m currently using imagemap to make map in game where player can travel to any location in map. So far i can make the description appear in tooltips like this :
So far i can make it like this for tooltips:

Code: Select all

    screen mymap():
    default tt = Tooltip("")

    imagemap:
        ground "ground.png"
        hover "hover.png"

        hotspot (355, 647, 500, 55) clicked Jump ("location1") hovered tt.Action("Description Example 1")
        hotspot (227, 568, 125, 130) clicked Jump ("location2") hovered tt.Action("Description Example 2")
        hotspot (1020, 446, 500, 200) clicked Jump ("location3") hovered tt.Action("Description Example 2")

        
        frame:
         vbox:
            xalign 0.7
            yalign 0.7
            text tt.value
                
but is there any way to make dialog appear instead using the tooltips? for example when hovering in location1 narrator will say "This is my home".

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to Make Dialog Appear When Hovering in Map

#2 Post by xela »

maryeliezka wrote:for example when hovering in location1 narrator will say "This is my home".
This:

Code: Select all

screen mymap():
    default tt = Tooltip("")

    textbutton "Meow":
        align .5, .5
        action NullAction() hovered tt.Action("Description Example 1"), With(dissolve)
        
    showif tt.value:
        use say("", tt.value)

label start:
    call screen mymap
You don't really need showif and With(dissolve) but they may give you some ideas on how to make it pretty. There are other ways of doing this as well, this is prolly the simplest.
Like what we're doing? Support us at:
Image

maryeliezka
Newbie
Posts: 23
Joined: Sat Sep 10, 2011 4:26 am
Completed: The Ghost on The Shore
Projects: Project Helix
Organization: Project Helix Team
Contact:

Re: How to Make Dialog Appear When Hovering in Map

#3 Post by maryeliezka »

It's working. thank you very much and sorry for asking a very simple question. Btw what that showif for? when i remove it, the code doesn't work

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: How to Make Dialog Appear When Hovering in Map

#4 Post by xela »

maryeliezka wrote:It's working. thank you very much and sorry for asking a very simple question. Btw what that showif for? when i remove it, the code doesn't work
It's not very usefull here because it should work the same with "if". Showif can be used paired with ATL events (instead/paired with dissolve transition). You can read about in screen docs.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], IrisColt