I know there is a way to change the color of a choice, but I'm trying to find a way where a specific choice is a certain color, rather than all choices are the same color.
I looked at documentation for it, where it said to use {color #whatever}Red{/color} but if I try that it doesn't work and just jumps to the next label (it's a customization thing so it's supposed to jump to the previous label). Is it something I just can't do with choices?
A way to color certain choices?
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.
Re: A way to color certain choices?
If you typed it in your program exactly as you have it in your question, you’re missing an equal sign between “color” and the #
This should work. Do you want to post the code for a menu where it isn’t working?
This should work. Do you want to post the code for a menu where it isn’t working?
Re: A way to color certain choices?
Okay, so I realized I stated the wrong issue. Turns out it does work but I guess not where I want it to? The actual choice, it does the color, but cycling through the colors is what gives it an issue-
Code: Select all
label start1_2
"Eye Color: [eyes]":
if eyes == "Red": #This is the text I wanted to change with the colors.
$ eyes = "Purple"
jump start1_2
if eyes == "Purple" #And then this would be purple.
$ eyes = "Some other color"
jump start 1_2
etc.
"next":
jump some_other
label some_other
Ultimately, it's no big deal. Just thought it would be neat if I could.
Re: A way to color certain choices?
So, just to make sure I understand what it is that you’re trying to do - when someone chooses “Red,” what you want is for the text of the menu to change to the corresponding color? Instead of (or in addition to) interpolating the name of the color via “[eyes]”?
(Just want to make sure I understand the nature of the problem so I’m not working on the wrong thing)
(Just want to make sure I understand the nature of the problem so I’m not working on the wrong thing)
Re: A way to color certain choices?
Yes. If it's something convoluted or more difficult than I realize, don't worry about it. Just thought it'd be a nice effect.rames44 wrote: ↑Wed Mar 20, 2019 11:28 am So, just to make sure I understand what it is that you’re trying to do - when someone chooses “Red,” what you want is for the text of the menu to change to the corresponding color? Instead of (or in addition to) interpolating the name of the color via “[eyes]”?
(Just want to make sure I understand the nature of the problem so I’m not working on the wrong thing)
Re: A way to color certain choices?
No, it's not that bad - I just wanted to make sure that I was heading in the direction that you wanted.
The thing you have to deal with is that colors aren't specified by names - they're specified by codes. So you need to do something like what I've shown before. Essentially, I create two variables - one with the human-readable color name, and the second with the hex color code, and substitute them both into the menu choice. Variable substitution is performed before the text tags are evaluated, so I can essentially stuff in the color code dynamically. (At least, with Ren'py 7.1.3, which is what I'm currently using.)
The thing you have to deal with is that colors aren't specified by names - they're specified by codes. So you need to do something like what I've shown before. Essentially, I create two variables - one with the human-readable color name, and the second with the hex color code, and substitute them both into the menu choice. Variable substitution is performed before the text tags are evaluated, so I can essentially stuff in the color code dynamically. (At least, with Ren'py 7.1.3, which is what I'm currently using.)
Code: Select all
default color_name = 'Red'
default color_code = '#f00'
label start:
label ask_the_question:
menu:
"Change color - currently {color=[color_code]}[color_name]{/color}":
menu:
"Change to {color=#f00}Red{/color}" if color_name != 'Red':
$ color_name = 'Red'
$ color_code = '#f00'
jump ask_the_question
"Change to {color=#0f0}Green{/color}" if color_name != 'Green':
$ color_name = 'Green'
$ color_code = '#0f0'
jump ask_the_question
"Change to {color=#00f}Blue{/color}" if color_name != 'Blue':
$ color_name = 'Blue'
$ color_code = '#00f'
jump ask_the_question
"Done":
pass
"All set"
return
Re: A way to color certain choices?
It works perfectly! Thanks so much!rames44 wrote: ↑Wed Mar 20, 2019 3:27 pm No, it's not that bad - I just wanted to make sure that I was heading in the direction that you wanted.
The thing you have to deal with is that colors aren't specified by names - they're specified by codes. So you need to do something like what I've shown before. Essentially, I create two variables - one with the human-readable color name, and the second with the hex color code, and substitute them both into the menu choice. Variable substitution is performed before the text tags are evaluated, so I can essentially stuff in the color code dynamically. (At least, with Ren'py 7.1.3, which is what I'm currently using.)
Code: Select all
default color_name = 'Red' default color_code = '#f00' label start: label ask_the_question: menu: "Change color - currently {color=[color_code]}[color_name]{/color}": menu: "Change to {color=#f00}Red{/color}" if color_name != 'Red': $ color_name = 'Red' $ color_code = '#f00' jump ask_the_question "Change to {color=#0f0}Green{/color}" if color_name != 'Green': $ color_name = 'Green' $ color_code = '#0f0' jump ask_the_question "Change to {color=#00f}Blue{/color}" if color_name != 'Blue': $ color_name = 'Blue' $ color_code = '#00f' jump ask_the_question "Done": pass "All set" return
Who is online
Users browsing this forum: Andredron, Google [Bot]