Player input uppercase/lowercase letters
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.
-
- Newbie
- Posts: 8
- Joined: Wed Jan 02, 2019 6:25 pm
- Contact:
Player input uppercase/lowercase letters
Hello. I want to include a player input, where it will not be a name, actually, so it must be in lower case. But if I start the sentence with this word - the first letter should be capitalized automatically. Is it doable?
Let's say, this word is 'teacher'.
So, player input this word, and then I use it like that:
"I am your teacher."
But then, if I start the sentence with this word - it should be like that:
"Teacher's orders."
After a little search, I realized that I will have to define two cases. [teacher] and [Teacher]
Is it correct?
Let's say, this word is 'teacher'.
So, player input this word, and then I use it like that:
"I am your teacher."
But then, if I start the sentence with this word - it should be like that:
"Teacher's orders."
After a little search, I realized that I will have to define two cases. [teacher] and [Teacher]
Is it correct?
- Remix
- Eileen-Class Veteran
- Posts: 1311
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Player input uppercase/lowercase letters
As variable names are case sensitive, you could just add an Upper case version and do something like:
Code: Select all
default pi_word = "teacher"
default Pi_word = "Teacher"
label start:
$ pi_word = renpy.input("Type Word").strip().lower()
$ Pi_word = pi_word.capitalize()
"So, you typed [pi_word]. [Pi_word] is ok."
Mad Scientist Todo List:
- Finish Improved Event Handler
- Implement DragonBones animation as a Creator Defined Container
- Develop Cartoon Speech Bubble dialogue
- Finish Bitmask collision and rebound vector system
- Develop time based building mechanic
- Others
- *Find a superb artist and actually write a game*
-
- Newbie
- Posts: 8
- Joined: Wed Jan 02, 2019 6:25 pm
- Contact:
Re: Player input uppercase/lowercase letters
Thanks, but I don't know what a player will input, so 'teacher' is just a guess.
I would like to use it for player input word.
I would like to use it for player input word.
- Remix
- Eileen-Class Veteran
- Posts: 1311
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Player input uppercase/lowercase letters
So, rather than try it and see it does exactly what you asked, you decided instead to presume it doesn't work and ignore it?
teacher/Teacher are just defaults for the two variables
(you Must set them no matter what method you use)
It then asks for input...
It trims and lowercases that for the lowercase variable
It Capitalizes that for the uppercase variable
Just try it
teacher/Teacher are just defaults for the two variables
(you Must set them no matter what method you use)
It then asks for input...
It trims and lowercases that for the lowercase variable
It Capitalizes that for the uppercase variable
Just try it
Mad Scientist Todo List:
- Finish Improved Event Handler
- Implement DragonBones animation as a Creator Defined Container
- Develop Cartoon Speech Bubble dialogue
- Finish Bitmask collision and rebound vector system
- Develop time based building mechanic
- Others
- *Find a superb artist and actually write a game*
-
- Newbie
- Posts: 8
- Joined: Wed Jan 02, 2019 6:25 pm
- Contact:
Re: Player input uppercase/lowercase letters
Yes, I thought, teacher/Teacher were predefined variables.
Thank you very much. Sorry for that
Thank you very much. Sorry for that
Who is online
Users browsing this forum: Andredron, Google [Bot]