Page 1 of 1

List index out of range in screens.rpy

Posted: Sat Mar 11, 2017 4:21 am
by princessap7
I tried using a custom image map for my main menu, and it gave out the error "IndexError: list index out of range". The main menu was working previously, but then I tried to scale up the ren'py screen and now it is giving out this error. Here are the traceback.txt and the main menu code:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 177, in execute
    screen main_menu():
  File "game/screens.rpy", line 177, in execute
    screen main_menu():
IndexError: list index out of range

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

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\ast.py", line 814, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\python.py", line 1719, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 30, in <module>
    ui.interact()
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\core.py", line 2526, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\core.py", line 2793, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\screen.py", line 399, in visit_all
    callback(self)
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\core.py", line 2793, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\screen.py", line 409, in per_interact
    self.update()
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\display\screen.py", line 578, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 177, in execute
    screen main_menu():
  File "game/screens.rpy", line 177, in execute
    screen main_menu():
  File "E:\AMANI\renpy-6.99.10-sdk\renpy\sl2\slast.py", line 770, in execute
    imc = renpy.ui.imagemap_stack[-1]
IndexError: list index out of range

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Mekellza 0.0

Code: Select all

screen main_menu():

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    imagemap:
        ground 'TitleIdle.png'
        idle 'TitleIdle.png'
        hover 'TitleHover.png'


    hotspot(71,108,406,119) action Start()
    hotspot(71,299,408,104) action ShowMenu("load")
    hotspot(68,586.0082304527,408,112) action ShowMenu("preferences")
    hotspot(73,943.7585733882,408,119) action Quit(confirm=False)]
I used this hotspot gen, by the way.

Re: List index out of range in screens.rpy

Posted: Sat Mar 11, 2017 4:24 am
by Ocelot
Hotspots should be part of imagemap block.

Re: List index out of range in screens.rpy

Posted: Sun Oct 18, 2020 7:01 am
by pepperdu
Replying for anyone who stumbles across this in the future, Ocelot's answer resolved my issue.