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

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
Nanahs
Regular
Posts: 169
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

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

#1 Post by Nanahs » Thu Oct 11, 2018 8:08 am

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 :)
Last edited by Nanahs on Sun Oct 14, 2018 10:22 am, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1337
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: xavimat
Location: Italy
Contact:

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

#2 Post by xavimat » 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"
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
unknown [Sci-Fi - mystery - computer]
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Nanahs
Regular
Posts: 169
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

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

#3 Post by Nanahs » Sun Oct 14, 2018 10:18 am

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 :)

Post Reply

Who is online

Users browsing this forum: Nero, Scribbles