How To Add renpy.input to Screen Instead of in Textbox?

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
User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

How To Add renpy.input to Screen Instead of in Textbox?

#1 Post by noeinan » Fri Nov 14, 2014 8:38 pm

I have three user input fields in the character selection screen for my game.

Currently, the user is prompted in the text box, and once the three user input fields are filled, they arrive at the character creation screen.

Code: Select all

label char_select:
    
    "Now, select your beginning."
    
    $ player_firstname = renpy.input("Given Name")
    $ player_firstname = player_firstname.strip()

    if player_firstname == "":
        $ player_firstname="Derya"
        
    $ player_surname = renpy.input("Family Name")
    $ player_surname = player_surname.strip()
    
    if player_surname == "":
        $ player_surname="Emin"
        
    $ player_age = renpy.input("Age")
    $ player_age = player_age.strip()
    
    if player_age == "":
        $ player_age="30"
    
    "Select your beginning."
    
    show screen charselect
    $ renpy.pause()
I have attached an image of my character selection screen. The other variables are set with buttons, and depending on the gender and job of the character, the portrait changes.

My problem is, I would like to move the user input onto my character selection screen-- so that when they type, they type into the empty fields indicated by age, given name, and family name. I have looked at the following threads:

General information about ui.input:
http://www.renpy.org/wiki/renpy/doc/ref ... s/ui.input

Using ui.input in nvl mode:
http://lemmasoft.renai.us/forums/viewto ... =8&t=22636

Customize the text in ui.input:
http://lemmasoft.renai.us/forums/viewto ... =8&t=10865

Displaying ui.input in a screen:
http://lemmasoft.renai.us/forums/viewto ... =8&t=16354

But I can't figure out how to get it to work. This is the closest that I've gotten:

Code: Select all

    $ ui.input('', xpos 607, ypos 163)
    $ player_age = ui.interact("Age")
    $ player_age = player_age.strip()
    
    if player_age == "":
        $ player_age="30"
But even though this is basically copy/paste from the official documentation, I keep getting an "Invalid syntax" error.

If anyone knows how to fix this up, I'd greatly appreciate it!
Attachments
User Input Boxes.png
Image

Image
Image

User avatar
ArachneJericho
Regular
Posts: 196
Joined: Sun Jun 22, 2014 2:04 am
Projects: Kaguya Hime
Tumblr: mousedeerproductions
Location: Seattle, WA, USA
Contact:

Re: How To Add renpy.input to Screen Instead of in Textbox?

#2 Post by ArachneJericho » Fri Nov 14, 2014 9:09 pm

Hello!

I made a project for you. When you click on a text field you get a dialogue prompting you for data, and then that text field is updated with the data. Text field is used loosely here; it's actually a text button so I can attach an action to it.

Check out both screens.rpy and script.rpy
Last edited by ArachneJericho on Fri Nov 14, 2014 9:10 pm, edited 1 time in total.

User avatar
ArachneJericho
Regular
Posts: 196
Joined: Sun Jun 22, 2014 2:04 am
Projects: Kaguya Hime
Tumblr: mousedeerproductions
Location: Seattle, WA, USA
Contact:

Re: How To Add renpy.input to Screen Instead of in Textbox?

#3 Post by ArachneJericho » Fri Nov 14, 2014 9:10 pm

Actually, those are dists. Oops.

Here is the project in a zip. sorry about that.
Attachments
Test Text Inputs.zip
(216.06 KiB) Downloaded 472 times

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: How To Add renpy.input to Screen Instead of in Textbox?

#4 Post by noeinan » Fri Nov 14, 2014 10:05 pm

Thanks for sharing. :D

I'm hoping there is a way to just click on the field, and then type right into it-- but if I can't find out how to do that I will probably use your code. My GUI adds a fair degree of detail, so I was worried with too many windows the screen would end up looking cluttered.
Image

Image
Image

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]