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.
If the container for the buttons is also a button, then when you hover the cursor over it, Renpy considers that the cursor was hovered over all the buttons inside. They all light up as if I hovered over each one of them.
Was this done on purpose? At the moment this looks like a bug.
I usually use a button container with an empty action so that clicking on the container doesn't trigger the dismiss. I don't need buttons inside another button to become one button.
init:
transform hover_at(t=.15):
on idle:
ease t zoom 1 alpha .25
on hover:
ease t zoom 1.2 alpha 1
screen test:
# i want to ensure that clicking this button does not activate the dismiss
button:
# if you hover over this button
background gui.accent_color
align(.5, .5)
xysize(config.screen_width // 2, config.screen_height // 2)
action NullAction()
# all the buttons inside will be highlighted
for i in [ .25, .5, .75 ]:
imagebutton:
idle Text("●", size=222)
focus_mask True
anchor(.5, .5)
pos(i, .5)
action Function(renpy.notify, "clicked")
at hover_at
label start:
show screen test
pause
return
If this is not a bug, then how can I make a container that will not change the state of the buttons inside?
Thank you for your attention.
It looks like that change was intentional (children of buttons get notified about hover and a few other states). Rather than using a button with NullAction as your container, you probably want a modal frame instead. That would prevent click through and avoid any hover events coming from the container.
strayerror wrote: ↑Sun Jan 21, 2024 2:55 pm
It looks like that change was intentional (children of buttons get notified about hover and a few other states). Rather than using a button with NullAction as your container, you probably want a modal frame instead. That would prevent click through and avoid any hover events coming from the container.
This is a great solution, thanks for the tip!
But it’s still a pity that I can’t regulate the connection between the container and the buttons inside. Sometimes it is still necessary - to attach one action to a large button, and another to the small buttons inside. For example, a save slot and an x button inside the slot, which is responsible for deleting this slot. These are essentially two different buttons, but the x will be highlighted when you hover over a slot. It would be nice to enable/disable the dependency on the parent container using some property.
Thanks again, you helped me a lot!
barsunduk wrote: ↑Mon Jan 22, 2024 7:48 am
But it’s still a pity that I can’t regulate the connection between the container and the buttons inside. Sometimes it is still necessary - to attach one action to a large button, and another to the small buttons inside. For example, a save slot and an x button inside the slot, which is responsible for deleting this slot. These are essentially two different buttons, but the x will be highlighted when you hover over a slot. It would be nice to enable/disable the dependency on the parent container using some property.
Thanks again, you helped me a lot!
You answered your question yourself. It is not a part of another button, so you should not shove it inside a button. What you describe is implemented by fixed containing a button and then another button drawn over it. fit_first on fixed ensires that it is the same size as your big button, so you can properly position smaller buttons inside.
When I use Live2d in Ren'Py 8.2.0, loading from the slots stops working and the game crashes into the main menu. UPD: Everything works again! It was a strange glitch.