[SOLVED] Input character limit not working

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.
Post Reply
Message
Author
belphe
Newbie
Posts: 9
Joined: Fri Sep 30, 2016 8:05 pm
Contact:

[SOLVED] Input character limit not working

#1 Post by belphe » Thu Dec 20, 2018 11:22 pm

Hi all,

Hope I can get some advice on this. I'm a newcomer to python coding, and I recently implemented being able to give their saves names in my current project.

It works fine with one exception - for some reason, the character limit I set is not being acknowledged, which will allow people to write straight off the window and give their save slots ridiculously long names. I've been all over the forums hoping to find a solution, but no dice.

Here's the code I'm using -

screen modal_input:
modal True
window at truecenter:
xmaximum 600
ymaximum 200
ypadding .5
xpadding .013
ypos 0.4
background("gui/saveinfoscreen.png")


text prompt style "input_prompt"
input id "input" style "input_text" default default

label get_save_name:
show screen save
$ save_name = renpy.call_screen("modal_input", prompt="Enter save information", default=save_name, length=25)
$ renpy.retain_after_load()
return


Any help with this issue would be appreciated!
Last edited by belphe on Sun Feb 24, 2019 12:22 pm, edited 2 times in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Input character limit not working

#2 Post by Per K Grok » Fri Dec 21, 2018 2:23 am

belphe wrote:
Thu Dec 20, 2018 11:22 pm
Hi all,

Hope I can get some advice on this. I'm a newcomer to python coding, and I recently implemented being able to name save slots in my current project.

It works fine with one exception - for some reason, the character limit I set is not being acknowledged, which will allow people to write straight off the window and give their save slots ridiculously long names. I've been all over the forums hoping to find a solution, but no dice.

Here's the code I'm using -

screen modal_input:
modal True
window at truecenter:
xmaximum 600
ymaximum 200
ypadding .5
xpadding .013
ypos 0.4
background("gui/saveinfoscreen.png")


text prompt style "input_prompt"
input id "input" style "input_text" default default

label get_save_name:
show screen save
$ save_name = renpy.call_screen("modal_input", prompt="Enter save information", default=save_name, length=25)
$ renpy.retain_after_load()
return


Any help with this issue would be appreciated!
try putting the length restriction in the line for the input instead

belphe
Newbie
Posts: 9
Joined: Fri Sep 30, 2016 8:05 pm
Contact:

Re: Input character limit not working

#3 Post by belphe » Fri Dec 21, 2018 11:21 am

Per K Grok wrote:
Fri Dec 21, 2018 2:23 am
try putting the length restriction in the line for the input instead
That worked! Thanks so much. I'd tried it before and gotten an error, but didn't think to take the "=" out. I appreciate you taking the time to help a novice :3

Post Reply

Who is online

Users browsing this forum: No registered users