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?
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:
- Remix
- Eileen-Class Veteran
- Posts: 1628
- 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."
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
-
- 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: 1628
- 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
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
-
- 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: Google [Bot]