Grabbing value of input [SOLVED]

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
nananame
Regular
Posts: 72
Joined: Fri Oct 13, 2017 1:40 pm
Contact:

Grabbing value of input [SOLVED]

#1 Post by nananame »

I'm trying to make a custom input screen I can use whenever I need the user to input something. The trouble I'm having is passing the value entered into the input field. I am using an input field and OK/CANCEL buttons to make it as user friendly as possible. It works fine when I press the ENTER key, but the problem is in pressing the OK button.

I have no idea how to get that value so I found this thread:
viewtopic.php?f=51&t=38080
and incorporated some of that into my code.

Relevant part of screen code:

Code: Select all

screen custom_input(question,filler):
    modal True
    frame:
        hbox:
            text [question]
        hbox:
            input default [filler] length 21 id "custom_unos"
        hbox:
            vbox:
                textbutton _("OK") action (input_func(renpy.get_widget("custom_input","custom_unos")), Return())
            vbox:
                textbutton _("Cancel") action Return(False)
The input_func works, it is just a variant of the store.variable_name = what_comes_in. The problem is in the renpy.get_widget. It returns some sort of strange value from the input field (looks like <Text "[...6b5af30>). With a little bit more fiddling I found out it seems to grab the Input object instead of the value....and that's where I'm stuck.

Is there anyway I can grab the value entered into the input field by pressing the OK button?
Last edited by nananame on Fri Oct 13, 2017 3:04 pm, edited 1 time in total.

nananame
Regular
Posts: 72
Joined: Fri Oct 13, 2017 1:40 pm
Contact:

Re: Grabbing value of input

#2 Post by nananame »

Hah, figured it out!
Thanks to everyone who read this, it can be marked as SOLVED or whatever!

Post Reply

Who is online

Users browsing this forum: No registered users