So, I'm trying to implement a map menu in my game using imagebuttons instead of an imagemap, because I want to display animations when the imagebuttons are hovered and unhovered. Looking into this, I came across a very similar thread here (viewtopic.php?f=8&t=45505) which was marked as [SOLVED] and tried implementing Xela's Displayable Switcher code, found in this post: viewtopic.php?p=463978#p463978.
However, when I tried using it in the game, I got the following uncaught exception error. Looks to me like the trouble is with the 'switch' being undefined, but I can't see how I implemented it differently than in the original code. Granted, the original code was intended for a game menu rather than a map, but I don't think it is really implemented all that differently. I'm still learning coding for ren'py, so maybe I'm missing something obvious though. Thanks for any help in solving it.
Note: I shortened directory information for privacy reasons, but otherwise did not edit the traceback.
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 22, in script
call screen map_menu
File "renpy/common/000statements.rpy", line 519, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "game/customatl.rpy", line 51, in per_interact
if renpy.python.py_eval_bytecode(c):
NameError: name 'switch' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 22, in script
call screen map_menu
File "C:\...\renpy-7.1.1-sdk\renpy\ast.py", line 1859, in execute
self.call("execute")
File "C:\...\renpy-7.1.1-sdk\renpy\ast.py", line 1847, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "C:\...\renpy-7.1.1-sdk\renpy\statements.py", line 179, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 519, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "C:\...\renpy-7.1.1-sdk\renpy\exports.py", line 2724, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "C:\...\renpy-7.1.1-sdk\renpy\ui.py", line 289, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 2662, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 3049, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 521, in visit_all
d.visit_all(callback, seen)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 521, in visit_all
d.visit_all(callback, seen)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 521, in visit_all
d.visit_all(callback, seen)
File "C:\...\renpy-7.1.1-sdk\renpy\display\screen.py", line 428, in visit_all
self.child.visit_all(callback, seen=None)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 521, in visit_all
d.visit_all(callback, seen)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 521, in visit_all
d.visit_all(callback, seen)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 521, in visit_all
d.visit_all(callback, seen)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 523, in visit_all
callback(self)
File "C:\...\renpy-7.1.1-sdk\renpy\display\core.py", line 3049, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "game/customatl.rpy", line 51, in per_interact
if renpy.python.py_eval_bytecode(c):
File "C:\...\renpy-7.1.1-sdk\renpy\python.py", line 1937, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "<string>", line 1, in <module>
NameError: name 'switch' is not defined
Windows-8-6.2.9200
Ren'Py 7.1.1.929
My Game 1.0
Thu Nov 29 10:53:25 2018