init -100:
define setlclvar = SetLocalVariable
screen loc(a = "1",b = "11"):
default tt = ""
vbox:
button:
text a
action NullAction()
hovered setlclvar("tt",b)
unhovered setlclvar("tt","")
text tt
it seems that "unhovered" have a problem with abbreviated version of the action and doesn't work, when try to reload, the game seems to enter an infinite loop.
the problem wouldn't occur if I replace the "setlclvar" with "SetLocalVariable" for "unhovered"
doesn't seem to have any problem with "SetScreenVariable" either
I don’t know if this has anything to do with it, but the SetLocalVariable function is marked as “not pure” in the Ren’py source code, while most other actions are marked as pure. So there may be something “special” about SetLocalVariable.
rames44 wrote: ↑Wed Mar 27, 2019 12:19 pm
the SetLocalVariable function is marked as “not pure” in the Ren’py source code, while most other actions are marked as pure. So there may be something “special” about SetLocalVariable.
now I have to wonder what @renpy.pure does.
I wish there was somewhere I could learn about these stuff, maybe I could learn enough to contribute to the development of renpy. unfortunately, while learning to make games with renpy is very easy, when it comes to what's going on under the hood, there's a lack of comments or documentation to give me an idea what am I looking at.
The concept of “pure” in Ren’py is “if called with the same inputs, you’ll always get the same output.” It implies that the item (function/object/whatever) doesn’t have any internal state that affects its behavior. I know that PyTom uses that information (pure or not) as an optimization when doing things like screen prediction. I haven’t looked at SetLocalVariable in any detail to see why it’s not pure or has anything to do with your issue - it was just something I noted.