Imagemap takes at least 3 arguments, 2 given.

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
Aoi14
Newbie
Posts: 23
Joined: Sun Dec 24, 2017 3:24 pm
Projects: GuardianS X
Location: Somewhere over the Rainbow
Contact:

Imagemap takes at least 3 arguments, 2 given.

#1 Post by Aoi14 »

I've never coded an imagemap before, so it puzzled me when this came up:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 331, in script
    $ result = renpy.imagemap("desktop1.png", [
  File "game/script.rpy", line 332, in <module>
    (145, 88, 307, 280, "scaweb"),
TypeError: imagemap() takes at least 3 arguments (2 given)

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 331, in script
    $ result = renpy.imagemap("desktop1.png", [
  File "/Applications/renpy-6.99.13-sdk/renpy/ast.py", line 827, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/Applications/renpy-6.99.13-sdk/renpy/python.py", line 1764, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 332, in <module>
    (145, 88, 307, 280, "scaweb"),
TypeError: imagemap() takes at least 3 arguments (2 given)

Here's my imagemap code:

Code: Select all

$ result = renpy.imagemap("desktop1.png", [
                           (145, 88, 307, 280, "scaweb"),
                          ])

            if result == "scaweb":
                t"Yay! You opened Browser."
I saw another similar topic, but I didn't exactly understand it. I'd really appreciate any help :)
Working on VNs. As usual :P

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Imagemap takes at least 3 arguments, 2 given.

#2 Post by vollschauer »

Well I guess renpy.imagemap() is old code from the Wiki, please don't use that!

And it would be more like:

Code: Select all

$ result = renpy.imagemap("desktop1.png", "desktop2.png", [
                           (145, 88, 307, 280, "scaweb"),
                          ])
Where desktop1 is your ground image and desktop2 is you selected one, anyway please use this instead:

https://www.renpy.org/doc/html/screens. ... statements

User avatar
Aoi14
Newbie
Posts: 23
Joined: Sun Dec 24, 2017 3:24 pm
Projects: GuardianS X
Location: Somewhere over the Rainbow
Contact:

Re: Imagemap takes at least 3 arguments, 2 given.

#3 Post by Aoi14 »

Thank you! This worked perfectly.
Working on VNs. As usual :P

Post Reply

Who is online

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