Page 1 of 1
VariableValue without the sliding
Posted: Tue Aug 28, 2018 7:02 am
by Ragnos
Maybe it's just me, but I've been trying for hours now to figure this out, and it's 6 AM here so maybe it's just that... So I'm pretty damn tired of messing with this.
So I have stat bars in my game in a stat screen that you can open and close at anytime. With StaticValue, Value, or other bar commands the bar will remain unmoving when the variable changes in the game, except for VariableValue which does what I want it to do, but the player can just slide the bar to the maximum level and be done with the whole game. XD
I just want the auto-updating of the bar that VariableValue offers without the player being able to manipulate it.
Thank you for your time.
Current code:
Code: Select all
screen stats():
frame:
has vbox
text "[dayname]"
text "Days Played: [daycount]"
text ("{size=28}Intelligence:{/size}")
bar value intelligence range 100 xmaximum 320 ymaximum 25
Re: VariableValue without the sliding
Posted: Tue Aug 28, 2018 9:09 am
by Kia
it's easier than you think, replace VariableValue with value
Re: VariableValue without the sliding
Posted: Tue Aug 28, 2018 7:50 pm
by Ragnos
it's easier than you think, replace VariableValue with value
Yes, I've done this already, however the bar doesn't change with the variable.
Such as a hunger stat that remains full even though it's at 0.
Current code.
Code: Select all
bar value hunger range 50 xmaximum 320 ymaximum 25
From Screen command
Code: Select all
screen stats():
frame:
has vbox
text "[dayname]"
text "Days Played: [daycount]"
text ("{size=28}Intelligence:{/size}")
bar value intelligence range 100 xmaximum 320 ymaximum 25
Re: VariableValue without the sliding
Posted: Tue Aug 28, 2018 8:55 pm
by philat
Nope. You're doing something wrong other than the bar. (Obviously we can't tell what that is.)
Re: VariableValue without the sliding
Posted: Tue Aug 28, 2018 9:39 pm
by Ragnos
philat wrote: ↑Tue Aug 28, 2018 8:55 pm
Nope. You're doing something wrong other than the bar. (Obviously we can't tell what that is.)
At least it narrows that down a bit then to know it's not the bar.
Could it be the screen itself then?
This is the screen that is displayed at the top of the screen at all times during gameplay.
Code: Select all
screen player_stats():
hbox:
textbutton "Stats" action Show("stats")
xalign 0.9 yalign 0.0
When shown you're given this:
Code: Select all
screen stats():
frame:
has vbox
text "[dayname]"
text "Days Played: [daycount]"
text ("{size=28}Intelligence:{/size}")
bar value intelligence range 100 xmaximum 320 ymaximum 25
textbutton "Close" action Hide("stats")
Could it be the hide function of the screen not allowing it to update properly then?
Re: VariableValue without the sliding
Posted: Tue Aug 28, 2018 10:59 pm
by Ragnos
Welp, I found the problem after a few more hours of questioning the various parts of how the bar works.
for the variables that the bar uses they were defined with "define" changing the variable definition to "default" instead of "define" fixed the problem with the bars refusing to move.
But now my question is why does the bar update with define in a VariableValue but not just regular value? And why does this not apply to other variable changes?
Re: VariableValue without the sliding
Posted: Wed Aug 29, 2018 12:02 am
by Kia
Variables that are defined using the define statement are treated as constant, are not saved or loaded, and should not be changed. (Ren'Py does not enforce this, but will produce undefined behavior when this is not the case.)