[Solved..?] Question about bars
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.
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.
[Solved..?] Question about bars
Hi everyone, I hope you're having a fantastic day.
Let's say we have a bar. This bar is long 820px and has range of 100. It indicates a variable that has a minimum of 0 and maximum of 100.
The way I imagined this to work is that range is going to be the maximum value of variable (100). Each time the value would increase by, let's say, 10, the bar would grow by 82px, up to the maximum of value = 100 and bar length of 820px.
It even sounds logical. Why does my bar reach the maximum length of 820 when the value is about 65 out of 100?
Let's say we have a bar. This bar is long 820px and has range of 100. It indicates a variable that has a minimum of 0 and maximum of 100.
The way I imagined this to work is that range is going to be the maximum value of variable (100). Each time the value would increase by, let's say, 10, the bar would grow by 82px, up to the maximum of value = 100 and bar length of 820px.
It even sounds logical. Why does my bar reach the maximum length of 820 when the value is about 65 out of 100?
Last edited by Lezalith on Sat Oct 01, 2016 8:11 am, edited 1 time in total.
Re: Question about bars
Post your code and let's see!
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
Re: Question about bars
Code: Select all
bar:
xpos 391
ypos 50
ysize 50
value AnimatedValue(value=skillValueNew, old_value=skillValueOld, delay=2, range=100)
left_bar "screens/teaching/teaching_baronly.png"
right_bar "GUI/Config/empty.png"
thumb NoneCode: Select all
$ skillValueOld = LeadershipValue
$ MoodAffection = (- MoodAfraid + MoodPressured)
if MoodAffection > 0:
$ MoodAffection = MoodAffection + 2
else:
pass
$ TeachingPoints = (MoodAffection + 6)*1.66667
$ LeadershipValue = (skillValueOld + TeachingPoints)
$ LeadershipValue = round(LeadershipValue, 3)
$ skillValueNew = LeadershipValueThis math stuff is actually done right (and always) before the bar is shown.
Re: Question about bars
Try something like (it worked for me)
If that doesn't work, there's surely something wrong with the math (tried the variable inspector?)
Code: Select all
$ mybar=AnimatedValue(value=skillValueNew, old_value=skillValueOld, delay=2, range=100)
bar value mybar xalign 0.5 yalign 0.1 xsize 820 #and other style stuffIf you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
Re: Question about bars
Didn't work for me.
But hey, this is weird:
I went to check how long actually is the added part of the bar, it says 134px.
Then I went on and recreate the bar with the same values into a new project, and it added 86px.
Then I had the idea of adding xmaximum. That shouldn't do much, because the teaching_baronly.png is of the exact needed width, but it changed the 134px to 88px. And I think I'll go with that, Because now it's only about 60px off of what it should be, but since it's an animated bar it's not all that recognizable.
But hey, this is weird:
I went to check how long actually is the added part of the bar, it says 134px.
Then I went on and recreate the bar with the same values into a new project, and it added 86px.
Then I had the idea of adding xmaximum. That shouldn't do much, because the teaching_baronly.png is of the exact needed width, but it changed the 134px to 88px. And I think I'll go with that, Because now it's only about 60px off of what it should be, but since it's an animated bar it's not all that recognizable.
Who is online
Users browsing this forum: Google [Bot], _ticlock_