Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
-
Jezzy
- Regular
- Posts: 30
- Joined: Wed Jun 21, 2017 2:18 pm
-
Contact:
#1
Post
by Jezzy » Tue May 07, 2019 8:59 am
Hello!
I was wondering if it was possible to add a inline if to a sayer string?
For example, if I want my sayer to say there is 2 apples, I would like to add a "s" to apple if apple is more than 2.
myCharacter "There is " + str("s" if apple > 1) + " in the basket"
How can I do this in Renpy?
Thanks!
-
Jezzy
- Regular
- Posts: 30
- Joined: Wed Jun 21, 2017 2:18 pm
-
Contact:
#3
Post
by Jezzy » Tue May 07, 2019 9:31 am
Thank you.
-
philat
- Eileen-Class Veteran
- Posts: 1853
- Joined: Wed Dec 04, 2013 12:33 pm
-
Contact:
#4
Post
by philat » Tue May 07, 2019 9:20 pm
If you prefer, you can also use python rather than renpy statements.
Code: Select all
$myCharacter("There {0} {1} apple{2} in the basket.".format("are" if apple==0 or apple>=2 else "is", apple, "s" if apple==0 or apple>=2 else ""))
Users browsing this forum: No registered users