Page 1 of 1

[solved] Can I "block" the screen in this case?

Posted: Thu Oct 11, 2018 8:08 am
by Nanahs
In my game I let the player choose their name with this code.

Code: Select all

define e = Character("[name]")

    $ name = renpy.input("What's your name?") 
    $ name = name.strip()
There are also a few other moments I let them answer by typing.

The problem is, if they click on the screen it jumps to another label. And the "[name]" becomes blanck.

So instead of a line for example being "Hello Jhon! Welcome to the game!" it would be "Hello _! Welcome to the game." hah

So, is there a way I can "block" the person from jumping the scene before they asnwer to the question?

Thank you :)

Re: Can I "block" the screen in this case?

Posted: Thu Oct 11, 2018 10:57 am
by xavimat
If I understand it well, that does not happen when they "click" on the screen, but when they press "Return" key on keyboard.

Here two solutions: one to ask again and another to get a default name automatically:

Code: Select all

# SOLUTION 1
default name = ""
define e = Character("[name]")
label start:
    while name == "":
        $ name = renpy.input("What's your name?").strip()

Code: Select all

# SOLUTION 2
default name = ""
define e = Character("[name]")
label start:
    $ name = renpy.input("What's your name?").strip() or "Johnny"

Re: Can I "block" the screen in this case?

Posted: Sun Oct 14, 2018 10:18 am
by Nanahs
xavimat wrote: Thu Oct 11, 2018 10:57 am If I understand it well, that does not happen when they "click" on the screen, but when they press "Return" key on keyboard.

Here two solutions: one to ask again and another to get a default name automatically:

Code: Select all

# SOLUTION 1
default name = ""
define e = Character("[name]")
label start:
    while name == "":
        $ name = renpy.input("What's your name?").strip()

Code: Select all

# SOLUTION 2
default name = ""
define e = Character("[name]")
label start:
    $ name = renpy.input("What's your name?").strip() or "Johnny"
Thank you so much! It worked :)