Confusing trouble with imagemaps [SOLVED!! :D]

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
Ixis
Newbie
Posts: 17
Joined: Thu May 27, 2010 4:12 pm
Contact:

Confusing trouble with imagemaps [SOLVED!! :D]

#1 Post by Ixis »

I'm having a lot of trouble trying to get imagemaps to work.

I'm making a really basic portfolio kind of thing with Ren'Py, but I keep bumping into trouble with imagemaps (which is a big problem since I want to handle the entire portfolio as several imagemaps.)

So I have these two image files, "selected.png" and "ground.png" and the following code (taken straight from the wiki more or less:)

Code: Select all

    k "What section would you like to view?"
    
    $ result = renpy.imagemap("ground.png", "selected.png", [
                           (100, 100, 300, 400, "writing"),
                           (500, 100, 700, 400, "drawing")
                          ])

    if result == "writing":
    "Writing" "Writing it is!"

    elif result == "drawing":
    "Drawing" "This is the drawing section."
I want an image displayed on screen at the time (a character called with "image XYZ at right" a few lines ago) to disappear, and then for ground.png to appear,

Image

then after that, if you highlight the right it'll display drawing selected, or if the left then writing.

Image

Should I have made two separate images (one for drawing, one for writing)? Is the one just fine? How do I get the code to work since I keep getting the following error,
On line 35 of C:\Documents and Settings\Kevin\My Documents\renpy-6.11.0\Kevin Campbell Portfolio/game/script.rpy: if statement expects a non-empty block.
if result == "writing":
^

On line 38 of C:\Documents and Settings\Kevin\My Documents\renpy-6.11.0\Kevin Campbell Portfolio/game/script.rpy: expected statement.
elif result == "drawing":
Any and all help/assistance would be greatly appreciated!
Last edited by Ixis on Fri Dec 03, 2010 11:07 pm, edited 1 time in total.

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Confusing trouble with imagemaps

#2 Post by Aleema »

You can have one ground (aka idle), one selected (aka hover) for both of those. I don't know what your ground looks like (you fixed it), but it depends on what changes between hovering and idling. Right now, it seems like they're both on their separate halves and shouldn't bother each other with a rectangular hotspot.

You error is because you need to indent/tab/move over after if statements. Meaning, it should look like:

Code: Select all

    if result == "writing":
        "Writing" "Writing it is!"

    elif result == "drawing":
        "Drawing" "This is the drawing section."
Not the fault of the imagemap. :3

p.s. I really like the design!

p.p.s. stuff like this goes into the Ren'Py Support subforum.

User avatar
Ixis
Newbie
Posts: 17
Joined: Thu May 27, 2010 4:12 pm
Contact:

Re: Confusing trouble with imagemaps

#3 Post by Ixis »

Sorry, and thanks for the info!

That fixed it! Man, I love how easy Ren'Py is to work with (compared with a lot of other engines I've tried.)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Lacha, Sirifys-Al