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.
-
Sumoslap
- Regular
- Posts: 59
- Joined: Tue Oct 12, 2010 10:02 pm
-
Contact:
#1
Post
by Sumoslap » Sat Apr 09, 2022 10:01 am
Hi all--I am using text input screens extensively in a game where players input a great deal of text. My input screens limit the number of characters players can input to 250 characters.
I would like to have a tiny screen that shows how many characters they have left as they input, updated dynamically: something as simple as "32/250."
Here is my code so far.
Code: Select all
$ skill = renpy.input("I am good at...", length=250)
$ skill = skill.strip()
if not skill:
$ skill = "You didn't enter anything."
$renpy.transition(dissolve)
call screen skillConfirm
I bet someone who knows what they're doing will be able to do this in seconds, but I am stumped. Happy to add any details that would help clarify what I am asking for. Thank you for all responses!
Last edited by
Sumoslap on Sat Apr 09, 2022 5:30 pm, edited 1 time in total.
-
jeffster
- Regular
- Posts: 123
- Joined: Wed Feb 03, 2021 9:55 pm
-
Contact:
#2
Post
by jeffster » Sat Apr 09, 2022 3:06 pm
Before you do the input you show a screen with the symbol count to indicate the string length.
So every time the player enters a new symbol the screen updates to show the new length.
I'm not sure how to show the update with "renpy.input", so I would use a screen with "input" statement:
https://www.renpy.org/doc/html/screens.html#input
Code: Select all
default str_len = 0
default skill = ""
screen count_symbols():
$ str_len = len(skill)
text "[str_len]/250":
pos (0, 0)
text "I am good at...":
pos (500, 450)
input:
pos (500, 500)
value VariableInputValue("skill")
copypaste True
label start:
show screen count_symbols
""
"You said [skill]"
-
Sumoslap
- Regular
- Posts: 59
- Joined: Tue Oct 12, 2010 10:02 pm
-
Contact:
#3
Post
by Sumoslap » Sat Apr 09, 2022 5:30 pm
Just as I suspected, someone who knows what they're doing could figure it out in a second.
Thanks so much! Let me know if I can return the favor someday!
-
jeffster
- Regular
- Posts: 123
- Joined: Wed Feb 03, 2021 9:55 pm
-
Contact:
#4
Post
by jeffster » Sat Apr 09, 2022 5:47 pm
OK. Tomorrow help some old lady to cross a road.