List index out of range in screens.rpy

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
princessap7
Newbie
Posts: 8
Joined: Thu Jul 16, 2015 3:33 am
Contact:

List index out of range in screens.rpy

#1 Post 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.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: List index out of range in screens.rpy

#2 Post by Ocelot »

Hotspots should be part of imagemap block.
< < insert Rick Cook quote here > >

pepperdu
Newbie
Posts: 12
Joined: Mon Nov 05, 2018 9:03 pm
Contact:

Re: List index out of range in screens.rpy

#3 Post by pepperdu »

Replying for anyone who stumbles across this in the future, Ocelot's answer resolved my issue.

Post Reply

Who is online

Users browsing this forum: decocloud, Google [Bot]