renpy input outside of the 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
Dr_arell
Regular
Posts: 34
Joined: Sun Feb 23, 2020 11:24 pm
Deviantart: DarellArt
Contact:

renpy input outside of the textbox

#1 Post by Dr_arell » Thu Sep 03, 2020 6:41 pm

ok here's the thing, a while ago i copied some code to move the text input out of the text box, but this moved the input outside in general when i just wanted to move it out for a one time use only.

i'm not that familiar with the text input so i cant fix it for myself. :(

Code: Select all

label cheats_input:
    hide screen telefono
    $ cheat = renpy.call_screen("input", prompt="      Enter cheat code", someText = "Something")
    hide phone
    if cheat == "hola":
        show phone

    while True:
        $ result = ui.interact()


screen input(prompt, someText = ""):
    viewport id "example":
        draggable False
        yanchor -145
        xanchor -790
        xmaximum 410
        ymaximum 790

        vbox:
            text prompt xalign 0.5
            spacing 690
            xmaximum 410
            input id "input" #style "input_text" default someText

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3071
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: renpy input outside of the textbox

#2 Post by Imperf3kt » Thu Sep 03, 2020 7:02 pm

A lot of this looks outdated, are you wanting a screen to show whenever a player types "hola", presumably without letting the user see an input box?

The H key already has a binding to "hide" the interface, so you'd have to edit that.

Have you seen this? It's not the same method, but I think it should achieve what you're after.
https://www.renpy.org/wiki/renpy/doc/co ... onami_Code
It's the old wiki, but unfortunately there is no modern equivalent in the new wiki, however the code works the same way.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

Dr_arell
Regular
Posts: 34
Joined: Sun Feb 23, 2020 11:24 pm
Deviantart: DarellArt
Contact:

Re: renpy input outside of the textbox

#3 Post by Dr_arell » Thu Sep 03, 2020 7:37 pm

i got this set up for a screen in a phone, and the the if statements its just a filler, i will use that to activate cheat codes.

the problem is aesthetic
i took 3 quick screenshots so u understand what i mean.

https://imgbox.com/g/sIpkbvfP1H

1 is how it looks when i try to call the input normally
2 the textbox that should display the input, as default
3 the input was moved to fit there, but as i said it

if you are curious this is how im displaying the input in the first image

Code: Select all

 $ ply = renpy.input("What's my name")

    ]$ ply = ply.strip()

    if ply == "":
        $ ply="Xavi"

and for the 3rd image im using the code posted above, i deleted meaningless things to not get confused

Code: Select all

label cheats_input:
    $ cheat = renpy.call_screen("input", prompt="      Enter cheat code", someText = "Something")

    while True:
        $ result = ui.interact()


screen input(prompt, someText = ""):
    viewport id "example":
        draggable False
        yanchor -145
        xanchor -790
        xmaximum 410
        ymaximum 790

        vbox:
            text prompt xalign 0.5
            spacing 690
            xmaximum 410
            input id "input" #style "input_text" default someText

Dr_arell
Regular
Posts: 34
Joined: Sun Feb 23, 2020 11:24 pm
Deviantart: DarellArt
Contact:

Re: renpy input outside of the textbox

#4 Post by Dr_arell » Thu Sep 03, 2020 7:48 pm

it seems like the name of the screen was the problem, maybe sharing "input" as name caused some trouble

Post Reply

Who is online

Users browsing this forum: Google [Bot]