Why imagebuttons blinks

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
cike
Newbie
Posts: 4
Joined: Tue Jun 04, 2019 12:18 am
Contact:

Why imagebuttons blinks

#1 Post by cike »

I want to creat some imagebuttons, which will disappear when clicked. In this way I can simulate collecting inventories.
However, when I clicked one button, the others will blink sometimes, not always.
I really don't know why.

My ren'py version is 7.2.2.491. And I tried old versions, not helping.

The simplified project is in the attachement.
Thank you very much.
Attachments
Test_buttons.7z
(612.79 KiB) Downloaded 24 times

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Why imagebuttons blinks

#2 Post by IrinaLazareva »

This blinks the image attached to the button. And, it blinks not in a random order, but in the order in which the buttons are written in the screen.
That is, the blinks appears in the button, which is temporarily "in focus".

I don't know if this is a bug or a feature of the screen language.

But there is a solution: create the condition not "above" the buttons, but "inside" them.
That is, to create a condition that the buttons do not actually disappear, but just become inactive and invisible:

Code: Select all

define click = "music/click.wav"
default button1_collected = True
default button2_collected = True
default button3_collected = True

screen buttons_screen:
    imagebutton:
        pos(500, 300)
        idle "images/button1.png"
        hover "images/button0.png"
        insensitive Null(width=100, height=100)
        action If(button1_collected, [Play("sound", click), SetVariable("button1_collected", False)], None)
    imagebutton:
        pos(1300, 300)
        idle "images/button2.png"
        hover "images/button0.png"
        insensitive Null(width=100, height=100)
        action If(button2_collected, [Play("sound", click), SetVariable("button2_collected", False)], None)
    imagebutton:
        pos(900, 600)
        idle "images/button3.png"
        hover "images/button0.png"
        insensitive Null(width=100, height=100)
        action If(button3_collected, [Play("sound", click), SetVariable("button3_collected", False)], None)
            
            
label start:
    scene black
    call screen buttons_screen
    return
https://renpy.org/doc/html/screens.html#if
https://renpy.org/doc/html/screens.html#imagebutton
https://www.renpy.org/doc/html/displayables.html#Null

P.S. But I don't rule out that there's a simpler solution... Maybe (I haven't checked) this effect will not happen when using the imagemap.
https://renpy.org/doc/html/screens.html ... statements

cike
Newbie
Posts: 4
Joined: Tue Jun 04, 2019 12:18 am
Contact:

Re: Why imagebuttons blinks

#3 Post by cike »

Thank you.
It seems to be a bug of screen language with if statement.
Your solution might be the best way for now.

Post Reply

Who is online

Users browsing this forum: DewyNebula