[Solved] Question On Using Screen Input

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
inahochama
Regular
Posts: 39
Joined: Tue Dec 15, 2009 12:38 am
Contact:

[Solved] Question On Using Screen Input

#1 Post by inahochama »

I know this is going to sound really silly but I'm really at a loss. After a player types/inputs a string using the screen input, how should I define that string as the player's name in the game? I know the answer is here but I keep hitting walls in all my search today orz
Last edited by inahochama on Tue Sep 20, 2011 5:08 am, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Question On Using Screen Input

#2 Post by Alex »


User avatar
inahochama
Regular
Posts: 39
Joined: Tue Dec 15, 2009 12:38 am
Contact:

Re: Question On Using Screen Input

#3 Post by inahochama »



Thank you for replying, but I've tried that one before and I know it works but I was hoping to use the screen input better. I mean I understood the screen input, at least I think I do but I can't seem to understand how I'm supposed to use and define the input name/string itself as the player's name and such. Here's the code.

script.rpy

Code: Select all

# Declare characters used by this game.
define player = #don't know what to do on this part
# The game starts here.
label start:

    show screen bg image
    show screen input 
    $ renpy.pause ()

    player "blah blah blah"

    return
screens.rpy

Code: Select all

screen input:
    hbox xalign .5 yalign .5:
        text "Name:" 
        input id "input"

    use quick_menu

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Question On Using Screen Input

#4 Post by KimiYoriBaka »

okay, so firstly, I'm not sure if the define character method is any different when it comes to dynamic characters. If not something like the following code should work:

Code: Select all

define player = DynamicCharacter("playername")
then later you just set playername equal to the input given with the following code:

Code: Select all

$ playername = renpy.input()
the input screen included by default in screens.rpy is meant for customizing how you want to display the prompt that pops up when you use the renpy.input() function. you shouldn't try to call it manually.

User avatar
inahochama
Regular
Posts: 39
Joined: Tue Dec 15, 2009 12:38 am
Contact:

Re: Question On Using Screen Input

#5 Post by inahochama »

KimiYoriBaka wrote: the input screen included by default in screens.rpy is meant for customizing how you want to display the prompt that pops up when you use the renpy.input() function. you shouldn't try to call it manually.
"facepalms" that actually made sense why I can edit the screen input but not know what to do with the "input" thing itself. I thought I can manually just call it without having to deal with renpy.input in the label start (I knew how to use it but I thought I can just have screen input do it or something). Thank you for clearing that up.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot