Question about Renpy bars (colors)
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.
Question about Renpy bars (colors)
So, guys, I'm a beginner but I've been learning a lot from this forum and from answers to past questions.
Anyways, recently I've been adding screens (like days or gold counters), everything worked and I think I have a decent grasp of using screens...
My question: next I want to add some stats page for various characters... I'm pretty sure I can figure out how to use screens for that.
Now for some stats I would like to add a bar to show the current level. I think I can figure that part out (or at least I will try to do so before I ask anything too detailed)
However, I'd like to do something maybe a little unusual with the bars...I was wondering if it would be possible to set it up so that the color of the filler bar changes depends on the value displayed.
Something like : Blue if it's below 20, green between 20 and 80, and red between 80 and 100 (for example)
as a total noob, it seems logical to me that some 'if' statement could help me, not sure they can be used to determine the color of bars though, or how to go about it. I've been looking at the bars section of the documentation but I don't see any specific mention of what I'm trying to do. Also not sure whether that would be done by modifying renpy scripts about all bars or with specific instructions.
any thoughts guys?
Anyways, recently I've been adding screens (like days or gold counters), everything worked and I think I have a decent grasp of using screens...
My question: next I want to add some stats page for various characters... I'm pretty sure I can figure out how to use screens for that.
Now for some stats I would like to add a bar to show the current level. I think I can figure that part out (or at least I will try to do so before I ask anything too detailed)
However, I'd like to do something maybe a little unusual with the bars...I was wondering if it would be possible to set it up so that the color of the filler bar changes depends on the value displayed.
Something like : Blue if it's below 20, green between 20 and 80, and red between 80 and 100 (for example)
as a total noob, it seems logical to me that some 'if' statement could help me, not sure they can be used to determine the color of bars though, or how to go about it. I've been looking at the bars section of the documentation but I don't see any specific mention of what I'm trying to do. Also not sure whether that would be done by modifying renpy scripts about all bars or with specific instructions.
any thoughts guys?
Re: Question about Renpy bars (colors)
Haven't tested it out but you cant try ConditionalSwitch: https://www.renpy.org/doc/html/displaya ... tionSwitch
What you would do is define your filler bar as an image block and put the necessary conditions. I once encountered in renpy cookbook project where when they attack the bar changes color after reaching a certain percentage so in theory it's similar to your problem. It's also possible to use the changed under the bars to call a function to do what you want. I'll give it a shot later once I'm done with what I need to do.
What you would do is define your filler bar as an image block and put the necessary conditions. I once encountered in renpy cookbook project where when they attack the bar changes color after reaching a certain percentage so in theory it's similar to your problem. It's also possible to use the changed under the bars to call a function to do what you want. I'll give it a shot later once I'm done with what I need to do.
Re: Question about Renpy bars (colors)
sounds interesting. I"ll give it a try too, as soon as I have the timeEnchant00 wrote: ↑Tue Sep 24, 2019 8:35 am Haven't tested it out but you cant try ConditionalSwitch: https://www.renpy.org/doc/html/displaya ... tionSwitch
What you would do is define your filler bar as an image block and put the necessary conditions. I once encountered in renpy cookbook project where when they attack the bar changes color after reaching a certain percentage so in theory it's similar to your problem. It's also possible to use the changed under the bars to call a function to do what you want. I'll give it a shot later once I'm done with what I need to do.
- Kia
- Eileen-Class Veteran
- Posts: 1040
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
- Contact:
Re: Question about Renpy bars (colors)
there are many ways to do this, one is using a color object as the bar's background, this way you can tweak r,g,b values individually and get any color you want, another is using image manipulators: https://www.renpy.org/doc/html/displaya ... nipulators
and like enchant00 mentioned condition switch.
you can even layer images on top of each other and adjust their alpha amount to get a blend of the two
and like enchant00 mentioned condition switch.
you can even layer images on top of each other and adjust their alpha amount to get a blend of the two
Re: Question about Renpy bars (colors)
that's good to know but how do I actually do it.... not sure I understand how to use any of those with barsKia wrote: ↑Wed Sep 25, 2019 1:28 am there are many ways to do this, one is using a color object as the bar's background, this way you can tweak r,g,b values individually and get any color you want, another is using image manipulators: https://www.renpy.org/doc/html/displaya ... nipulators
and like enchant00 mentioned condition switch.
you can even layer images on top of each other and adjust their alpha amount to get a blend of the two
any example?
Re: Question about Renpy bars (colors)
okay guys, not many replies on this topic....maybe it isn't possible (or extremely complicated)
could you at least point out some ways of just customizing the color of the bar.....
I've gone through a few tutorials and checked the GUI many times but I can't figure which lines set the bar's color
could you at least point out some ways of just customizing the color of the bar.....
I've gone through a few tutorials and checked the GUI many times but I can't figure which lines set the bar's color
- Kia
- Eileen-Class Veteran
- Posts: 1040
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
- Contact:
Re: Question about Renpy bars (colors)
I have an old example of bars changing colors with RGB values on one of my hard drives, just have to wait for my friend to bring it back.
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: Question about Renpy bars (colors)
Code: Select all
default elevel = 1
default ename = "Lucy"
screen status():
vbox at topleft:
text 'Name: [ename]'
text 'Level: [elevel]'
bar value StaticValue(elevel, 100) xpos 5 ysize 3 xmaximum 100 right_bar "#fff4":
if elevel < 20:
left_bar "#00f"
elif 20 <= elevel < 80:
left_bar "#0f0"
else:
left_bar "#f00"
#code below for the test
if elevel < 100:
timer .3 repeat True action SetVariable('elevel', elevel+1)
label start:
show screen status
'Level up'
https://renpy.org/doc/html/screens.html#bar
https://renpy.org/doc/html/screen_actio ... bar-values
https://renpy.org/doc/html/style_proper ... properties
https://renpy.org/doc/html/style_proper ... properties
Re: Question about Renpy bars (colors)
Thank you, this works great.IrinaLazareva wrote: ↑Fri Sep 27, 2019 4:12 pmhttps://renpy.org/doc/html/screens.html#ifCode: Select all
default elevel = 1 default ename = "Lucy" screen status(): vbox at topleft: text 'Name: [ename]' text 'Level: [elevel]' bar value StaticValue(elevel, 100) xpos 5 ysize 3 xmaximum 100 right_bar "#fff4": if elevel < 20: left_bar "#00f" elif 20 <= elevel < 80: left_bar "#0f0" else: left_bar "#f00" #code below for the test if elevel < 100: timer .3 repeat True action SetVariable('elevel', elevel+1) label start: show screen status 'Level up'
https://renpy.org/doc/html/screens.html#bar
https://renpy.org/doc/html/screen_actio ... bar-values
https://renpy.org/doc/html/style_proper ... properties
https://renpy.org/doc/html/style_proper ... properties
However, I'm not too sure how I would incorporate it in a screen that shows several of those (as it would show all the stats for a character).
I would need a different variable for each stat, obviously, and a lot of text.....
But, should I type all that for each bar or can I create a style that would affect all bars? (I think the second option would be a lot more efficient)
Tonight I'll try to work on that, but any advice would be greatly appreciated
Who is online
Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot]