Broken Imagemap (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
Banya
Regular
Posts: 106
Joined: Mon Mar 21, 2016 8:42 am
Projects: Spellbound
itch: banya
Location: Italy
Contact:

Broken Imagemap (Solved!)

#1 Post by Banya » Mon Feb 27, 2017 2:00 pm

I can't get over with this problem even with tutorials and wiki, so I thought of seeking help ^^"
I have a problem in shooting an imagemap in the game: I confronted the code with another fully-working imagemap and the other one is functioning, this one not; I underlined in magenta the two errors I have no idea how to fix, someone help me please ^^"

(I know it's probably going to be an obvious mess, but I'm a beginner coder and I still don't have solid bases...)
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/script.rpy", line 121, in script
call screen year_imagemap
File "renpy/common/000statements.rpy", line 463, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)

File "game/script.rpy", line 18, in execute
screen year_imagemap:
File "game/script.rpy", line 18, in execute
screen year_imagemap:
File "game/script.rpy", line 19, in execute
imagemap:
File "renpy/common/00defaults.rpy", line 115, in _imagemap_auto_function
rv = auto_param % variant
TypeError: not all arguments converted during string formatting


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

Full traceback:
File "game/script.rpy", line 121, in script
call screen year_imagemap
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\ast.py", line 1697, in execute
self.call("execute")
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\ast.py", line 1715, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\statements.py", line 144, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 463, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\exports.py", line 2475, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\ui.py", line 277, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 2437, in interact
scene_lists.replace_transient()
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 727, in replace_transient
self.remove(layer, tag)
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 1014, in remove
self.hide_or_replace(layer, remove_index, "hide")
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 938, in hide_or_replace
d = oldsle.displayable._hide(now - st, now - at, prefix)
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\display\screen.py", line 430, in _hide
self.update()
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\display\screen.py", line 565, in update
self.screen.function(**self.scope)
File "game/script.rpy", line 18, in execute
screen year_imagemap:
File "game/script.rpy", line 18, in execute
screen year_imagemap:
File "game/script.rpy", line 19, in execute
imagemap:
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\ui.py", line 1161, in _imagemap
selected_idle = pick(selected_idle, "selected_idle", idle)
File "C:\Users\sorog\Desktop\renpy-6.99.10-sdk\renpy\ui.py", line 1149, in pick
fn = renpy.config.imagemap_auto_function(auto, name)
File "renpy/common/00defaults.rpy", line 115, in _imagemap_auto_function
rv = auto_param % variant
TypeError: not all arguments converted during string formatting

Windows-8-6.2.9200
Ren'Py 6.99.10.1227
Ferry Boat 2 0.0

This is line 18-31
screen year_imagemap:
imagemap:

auto "images/sfondo_mappa1.png"
ground "images/sfondo mappa1.png"
idle "images/sfondo mappa1.png"
hover "images/sfondo mappa2.png"
alpha False

hotspot(245,261,136,133) action Return ("80s") alt "80s"
hotspot(11,295,139,124) action Return ("90s") alt "90s"
hotspot(406,364,130,122) action Return ("00s") alt "00s"
hotspot(607,264,136,124) action Return ("??") alt "??"
hotspot(479,107,133,119) action Return ("??s") alt "??s"
The game starts crasing from this exact point. As you can see, I even left the indications of the tutorial to help understanding better:
# Show an imagemap.
window hide None
call screen year_imagemap
window show None

# Call screen assignes the chosen result from the imagemap to the
# _return variable. We can use an if statement to vary what
# happens based on the user's choice.

if _return == "80s":

c "You chose 80s."

c "Fany music, yay!"

elif _return == "90s":

c "You chose 90s."

c "So predictable."

elif _return == "00s":

c "You chose 00s."

c "Such a hipster."

elif _return == "??":

c "You can't go there!"

elif _return == "??s":

c "You can't go there!"

window hide
Last edited by Banya on Mon Feb 27, 2017 6:34 pm, edited 1 time in total.

User avatar
Ocelot
Miko-Class Veteran
Posts: 849
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: Broken Imagemap (in execute call screen)

#2 Post by Ocelot » Mon Feb 27, 2017 2:16 pm

Code: Select all

auto "images/sfondo_mappa1.png"
auto property string have to contain and '%s' in it somewhere. This is the place where RenPy will insert names like 'idle'/'ground'/'hover'/etc. to get missing images. You should provide a template to generate filenames here, not filename itself.

Either get rid of auto statement here or use it properly:

Code: Select all

imagemap:
    auto 'images/sfondo_mappa_%s.png'
    # Rename your images as sfondo_mappa_idle, sfondo_mappa_ground, etc.
    # To make them recogniseable by this auto statement
< < insert Rick Cook quote here > >

User avatar
Banya
Regular
Posts: 106
Joined: Mon Mar 21, 2016 8:42 am
Projects: Spellbound
itch: banya
Location: Italy
Contact:

Re: Broken Imagemap (in execute call screen)

#3 Post by Banya » Mon Feb 27, 2017 2:24 pm

OMG it worked ;___; thank you so much Ocelot!

Post Reply

Who is online

Users browsing this forum: hell_oh_world