Imagemap (information in text box on hotspot)

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
Zebragirl
Newbie
Posts: 8
Joined: Fri Apr 05, 2013 3:54 pm
Contact:

Imagemap (information in text box on hotspot)

#1 Post by Zebragirl » Sun Apr 07, 2013 2:27 pm

Hello

Is possible have information (the place where you want to go) in the text box, passing mouse on hotspot before clicking?

Example: (passing mouse on hotspot):"in this place you can swim"
(clicking with the mouse on hotspot): "You picked swimming!"

And similarly, is possible do start an event (always just pointing with the mouse,before clicking for choosing)?



Thanks.

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Imagemap (information in text box on hotspot)

#2 Post by apricotorange » Sun Apr 07, 2013 5:56 pm

http://www.renpy.org/doc/html/screens.html#button . I think you're looking for "hovered" and "unhovered", like so:

Code: Select all

screen hovertext:
  default infobox = ""
  vbox:
    textbutton "Foo":
      action Return()
      hovered SetScreenVariable("infobox", "Foo here")
      unhovered SetScreenVariable("infobox", "")
    text infobox
(I'm using a button here for simplicity; hotspots in imagemaps support the same thing.)

User avatar
Zebragirl
Newbie
Posts: 8
Joined: Fri Apr 05, 2013 3:54 pm
Contact:

Re: Imagemap (information in text box on hotspot)

#3 Post by Zebragirl » Mon Apr 08, 2013 7:44 am

apricotorange wrote:http://www.renpy.org/doc/html/screens.html#button . I think you're looking for "hovered" and "unhovered", like so:

Code: Select all

screen hovertext:
  default infobox = ""
  vbox:
    textbutton "Foo":
      action Return()
      hovered SetScreenVariable("infobox", "Foo here")
      unhovered SetScreenVariable("infobox", "")
    text infobox
(I'm using a button here for simplicity; hotspots in imagemaps support the same thing.)
yes! That's exactly what I was looking ,but on the spot not work,where I wrong?

Code: Select all


screen example_imagemap:
    
  imagemap:
        
        default infobox = ""
        
        ground "Ground.jpg"
        hover "Hover.jpg"

        hotspot (8, 200, 78, 78) hovered SetScreenVariable("infobox", "swim")clicked Return("swim")
        hotspot (204, 50, 78, 78) clicked Return("science")
        hotspot (452, 79, 78, 78) clicked Return("art")
        hotspot (602, 316, 78, 78) clicked Return("go home")
        
        
        
          
label example:
    
    
    call screen example_imagemap
    
    $ result = _return
    
    
    if result == "swim":
        e "You picked swimming!"
    elif result == "science":
        e "You picked science!"
    elif result == "art":
        e "You picked art!"
    elif result == "go home":
        e "You went home!"

    return
Thanks for the reply.

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Imagemap (information in text box on hotspot)

#4 Post by apricotorange » Mon Apr 08, 2013 12:45 pm

You need a line like "text infobox" to actually show the text; setting the variable does nothing by itself.

User avatar
Zebragirl
Newbie
Posts: 8
Joined: Fri Apr 05, 2013 3:54 pm
Contact:

Re: Imagemap (information in text box on hotspot)

#5 Post by Zebragirl » Tue Apr 09, 2013 9:38 am

apricotorange wrote:You need a line like "text infobox" to actually show the text; setting the variable does nothing by itself.
Yes, my bad...
Now it works really well, thank you very much for help!

(This is solved for me)

Post Reply

Who is online

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