Imagemap Auto Error Help [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
SilverSnow
Regular
Posts: 182
Joined: Tue Aug 27, 2013 6:28 am
Completed: Bus Stop, Before the Tale, White Book Complete Volume, See You, The Raven
Projects: Secrets...
Tumblr: stchematelier
itch: st-chem-atelier
Location: Edge of Black Hole
Discord: SHatsuyuki#1452
Contact:

Imagemap Auto Error Help [Solved]

#1 Post by SilverSnow »

Hi! I tried using the imagemap auto function to try and facilitate things. I moved all screen elements under a subfolder in the gui and implemented the code as written and shown here.

Code: Select all

screen help():

    tag menu

    imagemap:
        auto "gui/help/help_%s.png"

        cache False
        alpha False

        hotspot (376, 120, 110, 38) action Start()
        hotspot (377, 164, 108, 36) action ShowMenu("load")
        hotspot (367, 207, 130, 33) action Return()
        hotspot (367, 248, 133, 36) action Quit(confirm=not main_menu)

Code: Select all

define config.imagemap_auto_function = True

This, however, resulted in an error.

Code: Select all

```
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 919, in execute
    screen help():
  File "game/screens.rpy", line 919, in execute
    screen help():
  File "game/screens.rpy", line 923, in execute
    imagemap:
TypeError: 'bool' object is not callable

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

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\ast.py", line 914, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\python.py", line 2028, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\ui.py", line 297, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\core.py", line 2702, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\core.py", line 3094, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\core.py", line 541, in visit_all
    d.visit_all(callback, seen)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\screen.py", line 430, in visit_all
    callback(self)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\core.py", line 3094, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\screen.py", line 440, in per_interact
    self.update()
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\display\screen.py", line 625, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 919, in execute
    screen help():
  File "game/screens.rpy", line 919, in execute
    screen help():
  File "game/screens.rpy", line 923, in execute
    imagemap:
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\ui.py", line 1246, in _imagemap
    ground = pick(ground, ( "ground", "idle" ), idle)
  File "C:\Users\Downloads\renpy-7.1.1-sdk\renpy\ui.py", line 1237, in pick
    fn = renpy.config.imagemap_auto_function(auto, i)
TypeError: 'bool' object is not callable

Windows-8-6.2.9200
Ren'Py 7.3.5.606
White Book 1.0
Sun May 17 16:36:53 2020
```
Would someone please point out what I did wrong? Thank you in advance.
Last edited by SilverSnow on Sun May 17, 2020 7:09 am, edited 1 time in total.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Imagemap Auto Error Help

#2 Post by hell_oh_world »

you used the config variable wrong, it should be a function and not a boolean like True or False, you don't need to tamper with it... just remove that line -> `define config.imagemap_auto_function = True`, and place all the images starting with `help_` inside the `image` folder. For me, I'll try moving first the images without any sub-folders and use the images directly without sub dirs like `"help_%s.png"`just to see if the auto-mapping really works...

User avatar
SilverSnow
Regular
Posts: 182
Joined: Tue Aug 27, 2013 6:28 am
Completed: Bus Stop, Before the Tale, White Book Complete Volume, See You, The Raven
Projects: Secrets...
Tumblr: stchematelier
itch: st-chem-atelier
Location: Edge of Black Hole
Discord: SHatsuyuki#1452
Contact:

Re: Imagemap Auto Error Help [Solved]

#3 Post by SilverSnow »

hell_oh_world wrote: Sun May 17, 2020 5:21 am you used the config variable wrong, it should be a function and not a boolean like True or False, you don't need to tamper with it... just remove that line -> `define config.imagemap_auto_function = True`, and place all the images starting with `help_` inside the `image` folder. For me, I'll try moving first the images without any sub-folders and use the images directly without sub dirs like `"help_%s.png"`just to see if the auto-mapping really works...
That did the trick! Just to be certain I applied the same code to the rest, and they all work smoothly now. Thank you! :D

Post Reply

Who is online

Users browsing this forum: No registered users