Textbuttons/Imagebuttons Not Displaying

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
TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Textbuttons/Imagebuttons Not Displaying

#1 Post by TheChatotMaestro »

My question about music ignored, as I suppose I'm an anomaly who needs a new computer in order to hear my own game, I moved on to putting the buttons that I wanted where I wanted. However, they didn't show up when I went into the intro to my game. I feel like this is purely my own error, though, unlike my previous problem.
My code looks like this:

Code: Select all

# Say
#
# Screen that's used to display adv-mode dialogue.
# http://www.renpy.org/doc/html/screen_special.html#say
screen say(who, what, side_image=None, two_window=False):

    # Decide if we want to use the one-window or two-window variant.
    if not two_window:

        # The one window variant.
        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who"

            text what id "what"

    else:

        # The two window variant.
        vbox:
            style "say_two_window_vbox"

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who"

            window:
                id "window"

                has vbox:
                    style "say_vbox"

                text what id "what"

    # If there's a side image, display it above the text.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0
        
    hbox:
            style_group "quick"
            xpos 650
            ypos 410
            textbutton _("Save") action ShowMenu('save')
            textbutton _("Load") action ShowMenu('load')
            textbutton _("Options") action ShowMenu('preferences')
            textbutton _("Menu") action MainMenu()

    # Use the quick menu.
    use quick_menu
And that's basically just the default, with that box with the textbuttons on the end. I took this code from a tutorial project (viewtopic.php?t=22565) because I could not for the life of me figure out how imagebuttons work (as the documentation is cryptic at best and impossible to understand at its worst; the tutorial project doesn't really help me, just says 'hey imagebuttons are a thing look what they can do k bye!!1!'; and I could find no 'how to make textbuttons' or 'how to make imagebuttons' spelled out for idiots like me) and I moved on to having textbuttons. What it's supposed to do is have four textbuttons in a row above the textbox... But they're not showing up. Am I being stupid and putting this block in the wrong place, or did I snip out some code that actually depends on four million complex features like everything else in this editor?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Textbuttons/Imagebuttons Not Displaying

#2 Post by Remix »

The screen say has its own area. generally at the lower part of the screen, so hbox: ypos 410 would be 410px below the top of the dialogue area which is likely off the screen.
Try xpos 0 and ypos 0 to start, then adjust

The 'use quick_menu' part should work to display them in *roughly* the usual place as long as you haven't altered the settings for them
Note: You would probably want to comment out:
# init python:
# config.overlay_screens.append("quick_menu")
from screens.rpy if putting them inside the say screen
Frameworks & Scriptlets:

TheChatotMaestro
Regular
Posts: 91
Joined: Mon Jul 31, 2017 8:33 am
Deviantart: LedianWithACamera
Contact:

Re: Textbuttons/Imagebuttons Not Displaying

#3 Post by TheChatotMaestro »

I figured it out- the imagebuttons weren't working, but the textbuttons were! They just didn't look like how I expected, they were tiny gray words instead of button-like buttons. But they showed up! Which is all I wanted. But thank you for the suggestion! I'll keep it in mind if anything happens again. :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot