Hello everyone. Yesterday I decided to switch to a new version of the engine 7.4.10 from version 7.3.5. Faced a problem. When you click on a pumpkin in the Screen, it should disappear, but at the same time, for some reason, another button (Witch) is highlighted for a split second. The focus mask does not help.
Version 7.3.5 did not have this problem.
I attach the file.
https://drive.google.com/file/d/1WWTG0t ... sp=sharing
[Bug] Blinking button.
[Bug] Blinking button.
Last edited by gofa4a on Tue Nov 16, 2021 5:47 am, edited 1 time in total.
Re: Bug: Blinking button.
Seen this (if i understand right what you talk about), wouldn't call it a bug exactly, just annoying little thing you have to keep in mind when doing certain things.
https://www.renpy.org/doc/html/screens. ... properties
Check "focus" property there.
Basically when screen have two buttons, then focused button disappear it try to refocus on something similar. As result focus moves to witch button, then next frame it defocus witch button because mouse is not hovering it.
What you can try:
Something like. At least it helped me with similar issue.
https://www.renpy.org/doc/html/screens. ... properties
Check "focus" property there.
Basically when screen have two buttons, then focused button disappear it try to refocus on something similar. As result focus moves to witch button, then next frame it defocus witch button because mouse is not hovering it.
What you can try:
Code: Select all
screen location(bg,objects):
add bg
for obj in objects:
imagebutton:
focus "loc_button_#"+obj["action"] ## generate unique enough id for each button and tell renpy to use it as focus id
focus_mask True
pos obj["pos"]
auto obj["image"]
action Return(obj["action"])
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
Re: Bug: Blinking button.
I understand this is an engine problem? And what changes do I need to make to the code?
Code: Select all
label start:
$ tikva_1 = False
"Use engine version 7.4.10. Click on the pumpkin. The witch button will light up for a split second. Why?"
show screen vedma
window hide
$inmenu = False
$onscreen = True
hide screen statusbar
$ ui.interact()
return
screen vedma:
add "Backgrounds/gorod_psiha/vedma/vedma_day.jpg"
add "Backgrounds/gorod_psiha/vedma/vedma_idle.png" xalign 0.08 yalign 0.09
imagebutton:
auto "Backgrounds/gorod_psiha/vedma/vedma_%s.png"
align (0.08,0.09)
action Jump ("start")
if tikva_1 == False:
imagebutton:
idle "Backgrounds/gorod_psiha/vedma/halloween/tikva_1_idle.png"
hover "Backgrounds/gorod_psiha/vedma/halloween/tikva_1_idle.png"
align (0.981,0.47)
action SetVariable("tikva_1", True)
Re: [Bug] Blinking button.
It is not a engine problem, i believe. Rather logical issue as i see it, tho if PyTom will fix/change it to be less quirky i wouldn't complain
To decide which imagebutton is focused renpy need to render them first, as it uses focus_mask. So it render everything, check what is focused and keep focus information, next frame it uses this information to render focused/not focused element differently, this is why single frame blink happens. Also it tries to use other information from previous interaction to decide how to show current interaction, this is why when you hide pumpkin button it tries to focus on next button it can find.
By providing stable hardcoded focus id you tell renpy how you want it to behave.
Didn't dived deep into focus guts, so it may differ, but idea is more or less this.
It is good idea to use same focus id for buttons using same image and/or action.
To decide which imagebutton is focused renpy need to render them first, as it uses focus_mask. So it render everything, check what is focused and keep focus information, next frame it uses this information to render focused/not focused element differently, this is why single frame blink happens. Also it tries to use other information from previous interaction to decide how to show current interaction, this is why when you hide pumpkin button it tries to focus on next button it can find.
By providing stable hardcoded focus id you tell renpy how you want it to behave.
Didn't dived deep into focus guts, so it may differ, but idea is more or less this.
Code: Select all
imagebutton:
focus "gorod_psiha_vedma_button" ## this line, just set it to something unique
auto "Backgrounds/gorod_psiha/vedma/vedma_%s.png"
align (0.08,0.09)
action Jump ("start")
Code: Select all
imagebutton:
focus "gorod_psiha_tikva_button" ## different focus id
idle "Backgrounds/gorod_psiha/vedma/halloween/tikva_1_idle.png"
hover "Backgrounds/gorod_psiha/vedma/halloween/tikva_1_idle.png"
align (0.981,0.47)
action SetVariable("tikva_1", True)
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
Re: [Bug] Blinking button.
I am a newcomer to renpy, so my solution may not be the best, but efficient to me.
Actually, I came across the same problem as well long time ago. Then I posted my problem here and got reply from some hero.
viewtopic.php?t=55531
I read his reply and reviewed the documentation of renpy several times, and finally improved the solution.
It seems that renpy engine will refresh some button if something in the same screen is hidden. We both use the "if" statement to hide the imagebutton, which forced the engine to refresh every button in the screen. As the hover image is applied, the image is shown and hidden in a short time, which looks like a blink.
If there is no hover image, there is no blink.
And the blink is displayed in a certain order. (I will not post it here, as it seldom matters the prolem.)
It may not be a bug, but has something to do will the logical issue of the engine.
If I only modify the button itself, not the whole screen, then other imagebuttons will not be refreshed, and there will be no blinks.
So here is the solution.
Here, by applying the "sensitive" and "insensitive" statements, we can only modify the sensibility of the button itself without affecting others.
You can try this.
Actually, I came across the same problem as well long time ago. Then I posted my problem here and got reply from some hero.
viewtopic.php?t=55531
I read his reply and reviewed the documentation of renpy several times, and finally improved the solution.
It seems that renpy engine will refresh some button if something in the same screen is hidden. We both use the "if" statement to hide the imagebutton, which forced the engine to refresh every button in the screen. As the hover image is applied, the image is shown and hidden in a short time, which looks like a blink.
If there is no hover image, there is no blink.
And the blink is displayed in a certain order. (I will not post it here, as it seldom matters the prolem.)
It may not be a bug, but has something to do will the logical issue of the engine.
If I only modify the button itself, not the whole screen, then other imagebuttons will not be refreshed, and there will be no blinks.
So here is the solution.
Code: Select all
screen vedma:
add "Backgrounds/gorod_psiha/vedma/vedma_day.jpg"
add "Backgrounds/gorod_psiha/vedma/vedma_idle.png" xalign 0.08 yalign 0.09
imagebutton:
auto "Backgrounds/gorod_psiha/vedma/vedma_%s.png"
align (0.08,0.09)
action Jump ("start")
imagebutton:
sensitive tikva_1_acquired==False
insensitive Null()
idle "Backgrounds/gorod_psiha/vedma/halloween/tikva_1_idle.png"
hover "Backgrounds/gorod_psiha/vedma/halloween/tikva_1_idle.png" # this line can be deleted, only keep the idle line.
align (0.981,0.47)
action SetVariable("tikva_1", True)
You can try this.
Re: [Bug] Blinking button.
And here is the "script.rpy" file, with some improvements of the codes.
I have problems in attachment full game.
I have problems in attachment full game.
- Attachments
-
- script.rpy
- (955 Bytes) Downloaded 25 times
Who is online
Users browsing this forum: No registered users