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.
-
Ragnos
- Regular
- Posts: 60
- Joined: Thu Oct 27, 2016 3:22 pm
-
Contact:
#1
Post
by Ragnos » Tue Aug 28, 2018 7:02 am
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
Last edited by
Ragnos on Tue Aug 28, 2018 8:12 pm, edited 1 time in total.
-
Kia
- Eileen-Class Veteran
- Posts: 1011
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#2
Post
by Kia » Tue Aug 28, 2018 9:09 am
it's easier than you think, replace VariableValue with value
-
Ragnos
- Regular
- Posts: 60
- Joined: Thu Oct 27, 2016 3:22 pm
-
Contact:
#3
Post
by Ragnos » Tue Aug 28, 2018 7:50 pm
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
-
philat
- Eileen-Class Veteran
- Posts: 1853
- Joined: Wed Dec 04, 2013 12:33 pm
-
Contact:
#4
Post
by philat » 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.)
-
Ragnos
- Regular
- Posts: 60
- Joined: Thu Oct 27, 2016 3:22 pm
-
Contact:
#5
Post
by Ragnos » Tue Aug 28, 2018 9:39 pm
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?
-
Ragnos
- Regular
- Posts: 60
- Joined: Thu Oct 27, 2016 3:22 pm
-
Contact:
#6
Post
by Ragnos » Tue Aug 28, 2018 10:59 pm
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?
-
Kia
- Eileen-Class Veteran
- Posts: 1011
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#7
Post
by Kia » Wed Aug 29, 2018 12:02 am
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.)
Users browsing this forum: No registered users