Button displayables?

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
synedraacus
Regular
Posts: 58
Joined: Tue Jun 09, 2015 8:10 am
Github: synedraacus
Contact:

Button displayables?

#1 Post by synedraacus » Thu Dec 10, 2015 11:49 pm

Dear everyone,
how do I make a button displayable? I have a custom displayable minigame that should, if certain conditions are met, show imagebuttons. What's a (Image|Text)button displayable class? There is ImageButton in renpy/display/behaviour.py, but I've tried

Code: Select all

# In MyDisplayable.__init__():
            self.exit_button = renpy.display.behavior.ImageButton(renpy.displayable('images/STRELKAH_VNEESE.png'),  action=TestExit())

# In MyDisplayable.render():
button_render = renpy.render(self.exit_button)
self.render_object.blit(button_render, (0, 0))
It doesn't throw any exceptions, but the button doesn't get displayed.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Button displayables?

#2 Post by xela » Fri Dec 11, 2015 5:48 am

You'll be better off using button on screens than through UDDs, especially if you do not inherit from themselves directly. Your code looks ok (if it's a short version obviously :) ), you prolly forgot to redraw or to it show properly. Or maybe main render is not setup appropriately...
Like what we're doing? Support us at:
Image

synedraacus
Regular
Posts: 58
Joined: Tue Jun 09, 2015 8:10 am
Github: synedraacus
Contact:

Re: Button displayables?

#3 Post by synedraacus » Fri Dec 11, 2015 9:06 am

What do you mean by "Inherit directly"? Create MyButton(Button) class?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Button displayables?

#4 Post by xela » Fri Dec 11, 2015 9:34 am

Yes, I am not 100% sure but while you should be able to render the button as you try it to without any issues, buttons are complex displayable with a lot of logic, states and complex event managements so the chances are that you'll be stuck with a button of a very limited functionality (more like an image).

My first instinct would be to plainly show the button on the screen (as suggested in the post above) and set states to a UDD minigame when required. There is little point in trying to render it through minigame's UDD class itself. If you really want to mess with that stuff or overwrite default button behavior, inherit from the Button, it should work then.

===
I haven't tried it so I just go with what I expect it to do, there is always a change that it'll work somehow, I am just not sure how/why that would happen just because you render it...
Like what we're doing? Support us at:
Image

synedraacus
Regular
Posts: 58
Joined: Tue Jun 09, 2015 8:10 am
Github: synedraacus
Contact:

Re: Button displayables?

#5 Post by synedraacus » Sun Dec 20, 2015 6:28 am

Sorry for the late answer. I have eventually got it working with the additional screen defined in screen language, thanks a lot for the advice.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Wadanohara