Only One option on the Image Map is working ♥

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
BrandonDeVITO
Newbie
Posts: 6
Joined: Wed Jan 23, 2013 12:09 pm
Completed: N/A
Projects: JUMPr (A Universe Jumping Android RPG)
Organization: 5|N Interactive
Contact:

Only One option on the Image Map is working ♥

#1 Post by BrandonDeVITO » Wed Jan 23, 2013 12:25 pm

Good morning. ☺

I'm facing a challenge which I can't seem to overcome. And I would appreciate any assistance which I could be offered.

The below code, by all my estimations, should be calling an imagemap with 7 options. And it is indeed calling the imagemap. And the first option works, however, none of the other 'buttons' are responding.

Did I miss a step in the code?

Code: Select all

label jumpr_menu:
   
    python:
        result = renpy.imagemap("images/girlmenu.png", "images/girlmenu.png" ,
        [
        (13, 8, 177, 178, "Girl1"),
        (88, 242, 174, 176, "Girl2"),
        (562, 243, 167, 170, "Girl3"),
        (216, 12, 168, 172, "Girl4"),
        (415, 12, 172, 172, "Girl5"),
        (615, 13, 175, 169, "Girl6"),
        (301, 305, 186, 43, "back"),
        ], focus="imagemap")
       
    if result == "Girl1":
        if KARMA >= 10:
            $ KARMA = 0
            $ GIRL = 1
            jump JUMPR
        else:
             centered "{b}{color=8C0000}You have insufficient Karma to ♦JUMP♦ to Sakura's Variant...{/b}{/color}"
             return
       
    elif result == "Girl2":
        if KARMA >= 10:
            $ KARMA = 0
            $ GIRL = 2
            jump JUMPR
        else:
             centered "{b}{color=8C0000}You have insufficient Karma to ♦JUMP♦ to Emiko's Variant...{/b}{/color}"
             return
       
    elif result == "Girl3":
        if KARMA >= 10:
            $ KARMA = 0
            $ GIRL = 3
            jump JUMPR
        else:
             centered "{b}{color=8C0000}You have insufficient Karma to ♦JUMP♦ to Mitsuru's Variant...{/b}{/color}"
             return
   
    elif result == "Girl4":
        if KARMA >= 10:
            $ KARMA = 0
            $ GIRL = 4
            jump JUMPR
        else:
             centered "{b}{color=8C0000}You have insufficient Karma to ♦JUMP♦ to Mayu's Variant...{/b}{/color}"
             return
   
    elif result == "Girl5":
        if KARMA >= 10:
            $ KARMA = 0
            $ GIRL = 5
            jump JUMPR
        else:
             centered "{b}{color=8C0000}You have insufficient Karma to ♦JUMP♦ to Ketsuya's Variant...{/b}{/color}"
             return
       
    elif result == "Girl6":
        if KARMA >= 10:
            $ KARMA = 0
            $ GIRL = 6
            jump JUMPR
        else:
             centered "{b}{color=8C0000}You have insufficient Karma to ♦JUMP♦ to Mayu's Variant...{/b}{/color}"
             return
        
    elif result == "back":
        return

User avatar
BrandonDeVITO
Newbie
Posts: 6
Joined: Wed Jan 23, 2013 12:09 pm
Completed: N/A
Projects: JUMPr (A Universe Jumping Android RPG)
Organization: 5|N Interactive
Contact:

Re: Only One option on the Image Map is working ♥

#2 Post by BrandonDeVITO » Wed Jan 23, 2013 1:51 pm

To answer my own question:

I use a program called 'irfanview' to determine my coordintaes. I misinterpreted the imaged map hotspots as X/Y Origin, with the size of the box.

From the Wiki:
hotspots - A list of tuples defining the hotspots in this image map. Each tuple has the format (x0, y0, x1, y1, result). (x0, y0) gives the coordinates of the upper-left corner of the hotspot, (x1, y1) gives the lower-right corner, and result gives the value returned from this function if the mouse is clicked in the hotspot.

In my case, this meant taking my starting points, and adding 180 to each of them (becuase my hotspots are 180 pixels wide.) in order to come up with the X1 and Y1 numbers.

All working now! ♥

User avatar
bleating
Newbie
Posts: 4
Joined: Tue Jan 22, 2013 5:13 am
Contact:

Re: Only One option on the Image Map is working ♥

#3 Post by bleating » Thu Jan 24, 2013 9:18 am

You also just fixed my problem, good work! ^^;

User avatar
Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

Re: Only One option on the Image Map is working ♥

#4 Post by Keul » Thu Jan 24, 2013 10:09 am

I've got also the same problem month ago.
The wiki is not clear about the origin of x1 and y1 (top left corner of the screen, or x0, y0)

User avatar
Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

Re: Only One option on the Image Map is working ♥

#5 Post by Keul » Thu Jan 24, 2013 10:20 am

In the http://www.renpy.org/wiki/renpy/Wiki_Home_Page, there's 2 links:
- The new manual that explains how to use Ren'Py, but isn't finished yet.
- The Reference Manual that contains the rest of the documentation.

In fact:
The good documentation that explains the new screen language with the last versions of renpy, with correct explaination of the hotspots:
http://www.renpy.org/doc/html/screens.html#hotspot

The "Reference Manual " that contains things that souldn't be used anymore (the old ways we create imagemaps) that is totally unclear with x1,y1 corordinates.
http://www.renpy.org/wiki/renpy/doc/ref ... y.imagemap

User avatar
Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

Re: Only One option on the Image Map is working ♥

#6 Post by Keul » Thu Jan 24, 2013 10:44 am


Post Reply

Who is online

Users browsing this forum: Ocelot