[Solved] Transform fails with SetVariable if the value is not changed

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
User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

[Solved] Transform fails with SetVariable if the value is not changed

#1 Post by _ticlock_ »

Hi, All,

The_Sauce found the following strange behavior that seems to be a bug:

Action with SetVariable cancels transform effects if old and new values of a variable used in SetVariable are the same:

Code: Select all

default param = 0

transform expand:
    on hover:
        linear 0.12 zoom 2.0
    on idle:
        linear 0.05 zoom 1.0

screen test:
    imagebutton at expand:
        idle Solid('#f00', xysize = (200,200))
        hover Solid('#0f0', xysize = (200,200))
        action  SetVariable("param", 0)

label start:
    call screen test
Transform works if we change to SetVariable("param", 1), so the new value is actually different from the old one.

Firstly I thought that renpy interprets this as action None if value is not changed, but it also cancels transform effect if we add additional action that normally triggers transforms:

Code: Select all

    imagebutton at expand:
        action  [ Return(), SetVariable("param", 0) ] 
PS:
HAPPY NEW YEAR!!!
Last edited by _ticlock_ on Fri Jan 01, 2021 7:07 am, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [BUG?] Transform fails with SetVariable if the value is not changed

#2 Post by philat »

Either set selected (https://www.renpy.org/dev-doc/html/screens.html#button ) to False or add selected_hover, selected_idle to the transform. Also, by default, a button is selected if any action in the list of actions returns as selected, so adding more things doesn't change anything (for what you're trying to do).

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: [BUG?] Transform fails with SetVariable if the value is not changed

#3 Post by _ticlock_ »

philat wrote: Fri Jan 01, 2021 3:29 am Also, by default, a button is selected if any action in the list of actions returns as selected, so adding more things doesn't change anything (for what you're trying to do).
I haven't realized it. Thanks a lot.

Post Reply

Who is online

Users browsing this forum: No registered users