tuple index out of range on ui.interact with new version

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

tuple index out of range on ui.interact with new version

#1 Post by jack_norton »

I'm working on Spirited Heart expansion, so I'm importing a game made with a very old Ren'Py version to see the problems I could get. One is this:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/chargen.rpy", line 239, in script
        $ ui.interact()
  File "C:\- indie dev -\games\renpy.new\Spirited Heart\game/chargen.rpy", line 266, in python
        $ ui.interact()
IndexError: tuple index out of range

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

Full traceback:
  File "C:\- indie dev -\games\renpy\renpy\execution.py", line 261, in run
  File "C:\- indie dev -\games\renpy\renpy\ast.py", line 630, in execute
  File "C:\- indie dev -\games\renpy\renpy\python.py", line 960, in py_exec_bytecode
  File "C:\- indie dev -\games\renpy.new\Spirited Heart\game/chargen.rpy", line 266, in <module>
  File "C:\- indie dev -\games\renpy\renpy\ui.py", line 236, in interact
  File "C:\- indie dev -\games\renpy\renpy\display\core.py", line 1641, in interact
  File "C:\- indie dev -\games\renpy\renpy\display\core.py", line 2057, in interact_core
  File "C:\- indie dev -\games\renpy\renpy\display\predict.py", line 105, in prediction_coroutine
  File "common/00library.rpy", line 365, in predict
  File "C:\- indie dev -\games\renpy\renpy\display\screen.py", line 402, in has_screen
IndexError: tuple index out of range

Windows-Vista-6.0.6002-SP2
Ren'Py 6.12.1.1501
and the code:

Code: Select all

label back01:
    $ starting_class=1
    scene bg_poor with dissolve
    $ ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
    $ ui.text("{size=48}{color=#FF0}The Farmers{/color}{/size}{p}{size=20}A couple of peasants found you in a nearby field, under a big old tree. They decided to take you with them and raise you as their own child. Living here will greatly increase your strength and stamina, but will lower wisdom and charisma.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)
    $ layout.button(u"Next", None, clicked=ui.jumps("back02"),ypos=400,xalign=1.0)
    $ layout.button(u"Prev", None, clicked=ui.jumps("back04"),ypos=400,xalign=0.0)
    $ layout.button(u"Select this one", None, clicked=ui.jumps("earlylife"),yalign=0.95,xalign=0.5)
    $ ui.interact()
label back02:
    $ starting_class=2
    scene bg_artist with dissolve
    $ ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
    $ ui.text("{size=48}{color=#FF0}The Artist{/color}{/size}{p}{size=20}A famous artist found you in his garden, tucked away in his gazebo. Being single, he decided to raise you with the help of several of his partners: he was a sort of a libertine. With this choice you'll have the chance to increase social skill and creativity, at the expense of reduced dexterity and concentration.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)
    $ layout.button(u"Next", None, clicked=ui.jumps("back03"),ypos=400,xalign=1.0)
    $ layout.button(u"Prev", None, clicked=ui.jumps("back01"),ypos=400,xalign=0.0)
    $ layout.button(u"Select this one", None, clicked=ui.jumps("earlylife"),yalign=0.95,xalign=0.5)
    $ ui.interact()
label back03:
    $ starting_class=3
    scene bg_general with dissolve
    $ ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
    $ ui.text("{size=48}{color=#FF0}The General{/color}{/size}{p}{size=20}When returning home from a battle, the general of the emperor's army found you near a big rock on the side of a road. He decided to adopt you as his only child. With this choice, you'll have increased concentration and dexterity, but decreased creativity and social skills.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)
    $ layout.button(u"Next", None, clicked=ui.jumps("back04"),ypos=400,xalign=1.0)
    $ layout.button(u"Prev", None, clicked=ui.jumps("back02"),ypos=400,xalign=0.0)
    $ layout.button(u"Select this one", None, clicked=ui.jumps("earlylife"),yalign=0.95,xalign=0.5)
    $ ui.interact()
label back04:
    $ starting_class=4
    scene bg_noble with dissolve
    $ ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
    $ ui.text("{size=48}{color=#FF0}The Noble{/color}{/size}{p}{size=20}A couple of local lords were unable to have children, so they decided to adopt you after you were found abandoned near their castle. Living your life as a noble during the early years of your life, you'll have increased charisma and wisdom, but decreased strength and stamina.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)
    $ layout.button(u"Next", None, clicked=ui.jumps("back01"),ypos=400,xalign=1.0)
    $ layout.button(u"Prev", None, clicked=ui.jumps("back03"),ypos=400,xalign=0.0)
    $ layout.button(u"Select this one", None, clicked=ui.jumps("earlylife"),yalign=0.95,xalign=0.5)
    $ ui.interact()
I wrote this code when I just started learning Ren'Py in 2008 so for sure is not really good and should probably rewrite it, however I'm wondering if the error I'm getting is normal?
follow me on Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: tuple index out of range on ui.interact with new version

#2 Post by PyTom »

Do you have config.debug_image_cache on? What's weird here is that Ren'Py is trying to predict an empty screen name - but screen prediction errors should be ignored.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: tuple index out of range on ui.interact with new version

#3 Post by jack_norton »

No I don't have that turned on...since I imported the original 2008 project, I don't think that command was yet available. If it's any help, in the previous Ren'Py version works, so must be something of this last 6.12.1 version :(
follow me on Image Image Image
computer games

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: tuple index out of range on ui.interact with new version

#4 Post by jack_norton »

This is getting even more "fun" ! I decided to rewrite that part, since was badly coded anyway (not that the new one is any good, but better). I still get the same error!!!!! :shock:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/chargen.rpy", line 253, in script
        python:
  File "game/chargen.rpy", line 257, in python
            i=ui.interact()
IndexError: tuple index out of range

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

Full traceback:
  File "C:\- indie dev -\games\renpy\renpy\execution.py", line 261, in run
  File "C:\- indie dev -\games\renpy\renpy\ast.py", line 630, in execute
  File "C:\- indie dev -\games\renpy\renpy\python.py", line 960, in py_exec_bytecode
  File "game/chargen.rpy", line 257, in <module>
  File "C:\- indie dev -\games\renpy\renpy\ui.py", line 236, in interact
  File "C:\- indie dev -\games\renpy\renpy\display\core.py", line 1641, in interact
  File "C:\- indie dev -\games\renpy\renpy\display\core.py", line 2057, in interact_core
  File "C:\- indie dev -\games\renpy\renpy\display\predict.py", line 105, in prediction_coroutine
  File "common/00library.rpy", line 365, in predict
  File "C:\- indie dev -\games\renpy\renpy\display\screen.py", line 402, in has_screen
IndexError: tuple index out of range

Windows-Vista-6.0.6002-SP2
Ren'Py 6.12.1.1501 
the new code is this:

Code: Select all

    $ starting_class=1
label pickbackg:
    if starting_class==1:
        scene bg_poor with dissolve
        python:
            ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
            ui.text("{size=48}{color=#FF0}The Farmers{/color}{/size}{p}{size=20}A couple of peasants found you in a nearby field, under a big old tree. They decided to take you with them and raise you as their own child. Living here will greatly increase your strength and stamina, but will lower wisdom and charisma.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)
    elif starting_class==2:
        scene bg_artist with dissolve
        python:
            ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
            ui.text("{size=48}{color=#FF0}The Artist{/color}{/size}{p}{size=20}A famous artist found you in his garden, tucked away in his gazebo. Being single, he decided to raise you with the help of several of his partners: he was a sort of a libertine. With this choice you'll have the chance to increase social skill and creativity, at the expense of reduced dexterity and concentration.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)
        
    elif starting_class==3:
        scene bg_general with dissolve
        python:
            ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
            ui.text("{size=48}{color=#FF0}The General{/color}{/size}{p}{size=20}When returning home from a battle, the general of the emperor's army found you near a big rock on the side of a road. He decided to adopt you as his only child. With this choice, you'll have increased concentration and dexterity, but decreased creativity and social skills.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)        
    elif starting_class==4:
        scene bg_noble with dissolve
        python:
            ui.window(xpos=512,ypos=500,xmaximum=1024,ymaximum=200,background="#0009")
            ui.text("{size=48}{color=#FF0}The Noble{/color}{/size}{p}{size=20}A couple of local lords were unable to have children, so they decided to adopt you after you were found abandoned near their castle. Living your life as a noble during the early years of your life, you'll have increased charisma and wisdom, but decreased strength and stamina.{/size}",justify=True, text_align=0.5, xalign=0.5,xmaximum=800)        
    python:
        layout.button(u"Next", None, clicked=ui.returns("back"),ypos=400,xalign=1.0)
        layout.button(u"Prev", None, clicked=ui.returns("next"),ypos=400,xalign=0.0)
        layout.button(u"Select this one", None, clicked=ui.returns("done"),yalign=0.95,xalign=0.5)
        i=ui.interact()
        if _return=="back":
            starting_class-=1
            if starting_class<1:
                starting_class=4
        elif _return=="next":
            starting_class+=1
            if starting_class>4:
                starting_class=1
    if _return=="done":
        jump earlylife
    jump pickbackg
follow me on Image Image Image
computer games

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: tuple index out of range on ui.interact with new version

#5 Post by PyTom »

Can you put together a short demo showing the bug? I may need to look into this, and perhaps release a workaround or fix.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: No registered users