renpy.input boxed in center of the screen?

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
Kokoro Hane
Eileen-Class Veteran
Posts: 1236
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, An Encounter ~In The Rain~, A Piece of Sweetness, Since When Did I Have a Combat Butler?!, Piece by Piece, +many more
Projects: Fateful Encounter, Operation: Magic Hero
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

renpy.input boxed in center of the screen?

#1 Post by Kokoro Hane »

When using renpy.input so the user can enter in their own name for the MC, is there a way to have that appear as its own textbox in the center of the screen with words above it (example; "What is your name?") instead of in the dialogue textbox? (As well as hide the dialogue textbox during this part)
PROJECTS:
Operation: Magic Hero [WiP]
Piece By Piece [COMPLETE][Spooktober VN '20]
RE/COUNT RE:VERSE [COMPLETE][RPG]
Since When Did I Have a Combat Butler?! [COMPLETE][NaNoRenO2020+]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

tigersmurf
Regular
Posts: 79
Joined: Sun May 15, 2011 11:50 pm
Projects: From Innocence
Location: The Evergreen State
Contact:

Re: renpy.input boxed in center of the screen?

#2 Post by tigersmurf »

Sure. If I understand you correctly, why not just create a screen (a background) that features the words you want? Use your background image for the current scene and your favorite photo editor, and then save it to your game folder and define it...


Code: Select all

image name = "what's your name.png"
and then...

Code: Select all

scene name with dissolve
Or anything like that.

That's the simplest way. You could also create an imagemap or imagebutton at the center of the screen that, when clicked, gives the user a chance to type in their character's name. http://lemmasoft.renai.us/forums/viewto ... f=8&t=9812

tigersmurf
Regular
Posts: 79
Joined: Sun May 15, 2011 11:50 pm
Projects: From Innocence
Location: The Evergreen State
Contact:

Re: renpy.input boxed in center of the screen?

#3 Post by tigersmurf »

Although, I may have misunderstood you. Did you mean you wanted them to be able to type in their name at the center? Sorry, I think I interpreted it as you just wanted the question "what's your name" to appear in the center. Oops.

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: renpy.input boxed in center of the screen?

#4 Post by Levrex »

Why, sure. Just edit the input screen as you'd do normally and don't forget to change the style.

The following code:

Code: Select all

screen input:

    window:

        style "nvl_window"
        
        text prompt xalign 0.5 yalign 0.4
        input id "input" xalign 0.5 yalign 0.5

    use quick_menu
produces the result you can see in an attached image.
Attachments
Nnm-1.jpg
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: renpy.input boxed in center of the screen?

#5 Post by xavimat »

I was looking for this, also. Thanks, Levrex.

Is there a way to show the question without deleting the former text? I mean, that's the usual behavior of the nvl mode, if you don't "nvl clear" it, it doesn't disappear. But with this modified input screen, the former text disappears.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Kokoro Hane
Eileen-Class Veteran
Posts: 1236
Joined: Thu Oct 27, 2011 6:51 pm
Completed: 30 Kilowatt Hours Left, The Only One Girl { First Quarter }, An Encounter ~In The Rain~, A Piece of Sweetness, Since When Did I Have a Combat Butler?!, Piece by Piece, +many more
Projects: Fateful Encounter, Operation: Magic Hero
Organization: Tofu Sheets Visual
Deviantart: kokoro-hane
itch: tofu-sheets-visual
Contact:

Re: renpy.input boxed in center of the screen?

#6 Post by Kokoro Hane »

Thank you so much! I'll definitely be trying that!
PROJECTS:
Operation: Magic Hero [WiP]
Piece By Piece [COMPLETE][Spooktober VN '20]
RE/COUNT RE:VERSE [COMPLETE][RPG]
Since When Did I Have a Combat Butler?! [COMPLETE][NaNoRenO2020+]
Crystal Captor: Memory Chronicle Finale [COMPLETE][RPG][#1 in So Bad It's Good jam '17]

But dear God, You're the only North Star I would follow this far
Owl City "Galaxies"

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: renpy.input boxed in center of the screen?

#7 Post by Levrex »

xavimat wrote:Is there a way to show the question without deleting the former text?
http://www.renpy.org/wiki/renpy/doc/ref ... s/ui.input

Either that or:

1) Add modal True and zorder 1 lines to the input screen.
2) Call the screen with $ x = renpy.call_screen("input", prompt="Whatcha gonna do?") instead of $ x = renpy.input("Whatcha gonna do?").
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: renpy.input boxed in center of the screen?

#8 Post by xavimat »

Levrex wrote:
xavimat wrote:Is there a way to show the question without deleting the former text?
1) Add modal True and zorder 1 lines to the input screen.
2) Call the screen with $ x = renpy.call_screen("input", prompt="Whatcha gonna do?") instead of $ x = renpy.input("Whatcha gonna do?").
Thanks, Levrex. I've used your modificatins and it's working. I can't use, though, the "deafult" parameter of the input. It's that possible?
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Levrex
Veteran
Posts: 280
Joined: Mon Jun 18, 2012 12:16 pm
Contact:

Re: renpy.input boxed in center of the screen?

#9 Post by Levrex »

Doesn't seem like so, because those functions understand "default" parameter differently.

You can, however, check if the returned string is an empty one and, if that's the case, i.e. if the user does not input anything, assign it a "standard" value. The user won't see it when the screen appears, though, but you can still write in the prompt string that «if you leave the string empty, you will be referred to as John Doe».
If your question is solved, please add [Solved] to theme's name by editing its first post, so that the helpful guys out there wouldn't mistakenly think the problem is still unanswered and waste their time.

DragoonHP
Miko-Class Veteran
Posts: 758
Joined: Tue Jun 22, 2010 12:54 am
Completed: Christmas
IRC Nick: DragoonHP
Location: Zion Island, Solario
Contact:

Re: renpy.input boxed in center of the screen?

#10 Post by DragoonHP »

xavimat: Modify your imput screen

Code: Select all


screen input(prompt, someText = ""):

    window style "input_window":
        has vbox

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

Then call your screen like this: $ x = renpy.call_screen("input", prompt="Whatcha gonna do?", someText = "Something")

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: renpy.input boxed in center of the screen?

#11 Post by xavimat »

DragoonHP wrote:xavimat: Modify your imput screen

Code: Select all


screen input(prompt, someText = ""):

    window style "input_window":
        has vbox

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

Then call your screen like this: $ x = renpy.call_screen("input", prompt="Whatcha gonna do?", someText = "Something")
Thanks, DragoonHP. It's working!
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
MilywayObree
Newbie
Posts: 17
Joined: Sun Jan 28, 2018 11:24 am
Completed: None so far, pending to be exact
Projects: DDLC, The notebook and other secret projects
Organization: Vocastin/Oriaa Pro-Creations
Deviantart: MexicoRPelino
Github: HizashiroTakahashi
Skype: PixelMINEGaming
Location: Philippines
Contact:

Re: renpy.input boxed in center of the screen?

#12 Post by MilywayObree »

Umm... if you would want it to be in a frame, you would want to do this...
This example is what i used for a mod, the game is a game I made that I call "Roll":

Code: Select all

screen guess_input(roll_action, roll_act):
    modal True

    zorder 200

    style_prefix "confirm"

    add "gui/overlay/confirm.png"
    key "K_RETURN" action [Play("sound", gui.activate_sound)]

    frame:

        vbox:
            xalign .5
            yalign .5
            spacing 30

            label _("What will be your guess?"):
                style "confirm_prompt"
                xalign 0.5

            input default "None" value VariableInputValue("guess2") length 1 allow "012345"

            hbox:
                xalign 0.5
                spacing 100

                textbutton _("Guess!") action [ roll_action, roll_act, Hide("guess_input"), Show("guessed") ]
now you would want to define the variable..

Code: Select all

default persistent.guess = ""
default guess2 = persistent.guess
default roll2 = None
init python:
    def FinishGuess():
        persistent.guess = guess2
and now this....

Code: Select all

call screen guess_input(roll_action=Function(FinishGuess), roll_act=SetVariable("roll2", (random.randint(1,5))))

e "you guessed the number [guess2], let's see if it is correct!"

menu:
    "Roll":
        show text("You rolled the number [roll2]")

if roll2 == 1:
     if guess2 == 1:
        e "you guessed the correct number!"
        call win
    else:
        e "sorry, you guessed the wrong number!"
        call tryagain
and so on.....
Just Monika.

EternalVoid
Newbie
Posts: 13
Joined: Thu Oct 15, 2020 9:59 am
Soundcloud: DivinePlane
Contact:

Re: renpy.input boxed in center of the screen?

#13 Post by EternalVoid »

I have tried this because I wanted to make an nvl visual novel, but I can't seem to put the input thing on top of the nvl thing. Maybe if I delete image of the nvl background?

I don't want to do that though, so help on this would be welcome.

Post Reply

Who is online

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