[Solved] not a button defined in this gallery error

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
Rabby
Newbie
Posts: 11
Joined: Tue Aug 24, 2021 3:29 pm
Contact:

[Solved] not a button defined in this gallery error

#1 Post by Rabby »

I keep getting an error that the first button in the list isn't defined, I can't quite tell why

Code: Select all

init python:

    g = Gallery()

    g.button("ending1")
    g.condition("persistent.unlock_1w")
    g.image("locked")

    g.button("ending2")
    g.condition("persistent.unlock_2w")
    g.image("locked")

    g.button("ending3")
    g.condition("persistent.unlock_3w")
    g.image("locked")

    g.button("ending4")
    g.condition("persistent.unlock_4w")
    g.image("locked")

    g.button("ending5")
    g.condition("persistent.unlock_5w")
    g.image("locked")

    g.button("ending6")
    g.condition("persistent.unlock_6w")
    g.image("locked")

    g.transition = dissolve
Last edited by Rabby on Sat Jan 29, 2022 4:56 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: [Question] not a button defined in this gallery error

#2 Post by Alex »

What's the part of code where you show those buttons in a screen?

Rabby
Newbie
Posts: 11
Joined: Tue Aug 24, 2021 3:29 pm
Contact:

Re: [Question] not a button defined in this gallery error

#3 Post by Rabby »

Code: Select all

screen 2_Gallery():


    tag menu



    grid 2 3:


        xfill True
        yfill True

        add g.make_button("ending1", "locked.png", xalign=0.5, yalign=0.5)
        add g.make_button("ending2", "locked.png", xalign=0.5, yalign=0.5)
        add g.make_button("ending3", "locked.png", xalign=0.5, yalign=0.5)


        add g.make_button("ending4", "locked.png", xalign=0.5, yalign=0.5)
        add g.make_button("ending5", "locked.png", xalign=0.5, yalign=0.5)
        add g.make_button("ending6", "locked.png", xalign=0.5, yalign=0.5)

        null
        null

        textbutton "Return" action Return() xalign 0.5 yalign 0.5

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: [Question] not a button defined in this gallery error

#4 Post by Alex »

Nothing wrong at first sight...
If you still get this error post the error message. And do you have only one gallery in your project?

Rabby
Newbie
Posts: 11
Joined: Tue Aug 24, 2021 3:29 pm
Contact:

Re: [Question] not a button defined in this gallery error

#5 Post by Rabby »

I have a second gallery and they both have the same gallery definition although I've tried changing it and that doesn't work either.

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: [Question] not a button defined in this gallery error

#6 Post by Alex »

Could you share cut-off project (all gallery codes with necessary images) to let people test it?

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: [Question] not a button defined in this gallery error

#7 Post by rayminator »

do you have a character defined with a g at all?

Code: Select all

define g = Character("Amy")
without the traceback log we can't really help you all we can do is guess

Rabby
Newbie
Posts: 11
Joined: Tue Aug 24, 2021 3:29 pm
Contact:

Re: [Question] not a button defined in this gallery error

#8 Post by Rabby »

Ended up changing the format for the gallery, I'll throw it here In case if someone needs it

Code: Select all

#ex of defintion make the amount you need 
    g= Gallery()

    g.button("ending1e")
    g.condition("persistent.unlock_1w")
    g.image("locked")

screen ofic_gallery():

   # Ensure this replaces the main menu.
    tag menu

    # The background unhash this when I have a bg to put there 
    #add "cgbackground.png"

    # The default page
    default curpage = "page1"

    vbox:
        # Page switching buttons
        hbox:              #this name below the hashtag can be changed as long as the "page1-3" matches in grids
            textbutton "Page1" action SetScreenVariable("curpage", "page1")
            textbutton "Page2" action SetScreenVariable("curpage", "page2")
            textbutton "Page3" action SetScreenVariable("curpage", "page3")

   # The background.

    grid 2 3:


        xfill True
        yfill True

        if curpage == "page1":
            add g.make_button("ending1", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending2", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending3", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending4", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending5", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending6", "locked.png", xalign=0.5, yalign=0.5)
        if curpage == "page2":
            add g.make_button("ending1w", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending2w", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending3w", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending4w", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending5w", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending6w", "locked.png", xalign=0.5, yalign=0.5)
        if curpage == "page3":
            add g.make_button("ending1e", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending2e", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending3e", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending4e", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending5e", "locked.png", xalign=0.5, yalign=0.5)
            add g.make_button("ending6e", "locked.png", xalign=0.5, yalign=0.5)

    textbutton "Return" action Return() xalign 1 yalign 1.0

Post Reply

Who is online

Users browsing this forum: No registered users