Image Map - Only one choice? [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
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Image Map - Only one choice? [Solved]

#1 Post by Destiny » Thu Jun 14, 2012 5:25 pm

Hello :)
sorry in advance, I first postet it in Creator Discussion until I realised, here is the place for such questions...

I'm working on my project for a while already and now, since I got most the artwork done, I wanted to work on the script.
Most things are fine thanks to the wiki.
BUT I just can't really get my image map to work.

Code: Select all

label menu_room_player:
$ result = renpy.imagemap("Schule.png", "Hover.png", [
        (43, 42, 181, 94, "bed"),
        (347, 41, 183, 93, "door"),
        (586, 42, 179, 87, "chest"),
        (300, 239, 211, 102, "mirror"),
        (43, 441, 181, 93, "schrank"),
        (309, 439, 188, 90, "kuchen"),
        (571, 439, 178, 89, "sofa"),
        ], focus="imagemap")

if result == "bed":
    me "Time to sleep!"
elif result == "door":
    me "Time to head out!"
elif result == "chest":
    me "What do I got...!"
elif result == "mirror":
    me "So how am I doing?"
elif result == "schrank":
    me "What do I got...!"
elif result == "kuchen":
    me "What do I got...!"
elif result == "sofa":
    me "What do I got...!"
Here the graphics I used for testing:
Hover.png and Schule.png

At least on my computer is the result always the same.
Only the block on the upper left changes and can be clicked. And also only half of the block.
Did I do something wrong anywhere?
Because I really need the image map.

Thanks in advance!
Last edited by Destiny on Fri Jun 15, 2012 9:15 am, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Image Map - Only one choice?

#2 Post by Alex » Thu Jun 14, 2012 5:42 pm

The problem is in hotspots - they are wrong. You are using an old-style imagemap, so "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."
http://www.renpy.org/wiki/renpy/doc/ref ... y.imagemap

User avatar
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Re: Image Map - Only one choice?

#3 Post by Destiny » Fri Jun 15, 2012 3:39 am

Ah, I got it!
Sorry, I did read the hint with "shift+d", but I simply copied the coordinates from the rectangle instead of the corners.

Thanks a lot! :)

Post Reply

Who is online

Users browsing this forum: No registered users