Page 1 of 1

Unfixable Imagemapping mistake

Posted: Sun Nov 15, 2015 12:07 am
by Karunakku
So I started a project and I decided to put some imagemapping to the main menu, but when I did that(I did everything right), a mistake called "List index out of range" shows up.

Here is my code:

Code: Select all

##############################################################################
# Main Menu
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu():

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

    # The background of the main menu.
    window:
        style "mm_root"
        
        imagemap:
            ground "Buttons/Ground.png"
            idle "Buttons/Idle.png"
            hover "Buttons/Hover.png"
        
            alpha False
        # This is so that everything transparent is invisible to the cursor. 

        hotspot (373,262,429,307) action Start()
        hotspot (369,310,434,353) action ShowMenu("load")
        hotspot (359,358,445,404) action ShowMenu("preferences")
        hotspot (376,408,426,451) action Help()
        hotspot (377,454,425,497) action Quit(confirm=False)

init -2:

    # Make all the main menu buttons be the same size.
    style mm_button:
        size_group "mm"
Thanks in advance for the person who will help me!

Re: Unfixable Imagemapping mistake

Posted: Sun Nov 15, 2015 12:36 am
by Zetsubou
The problem appears to be your indenting.
The hotspots need to have the same level of indentation as the other fields in the imagemap.
ie.

Code: Select all

        imagemap:
            ground "Buttons/Ground.png"
            idle "Buttons/Idle.png"
            hover "Buttons/Hover.png"
        
            alpha False

            hotspot (373,262,429,307) action Start()
            hotspot (369,310,434,353) action ShowMenu("load")
            hotspot (359,358,445,404) action ShowMenu("preferences")
            hotspot (376,408,426,451) action Help()
            hotspot (377,454,425,497) action Quit(confirm=False)

Re: Unfixable Imagemapping mistake

Posted: Sun Nov 15, 2015 10:29 am
by Karunakku
Thank you!

I just realised most of my mistakes are indent related O-O Well, I only have the software since yesterday. I guess it's normal XD