How to make a question

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
RedLlama
Newbie
Posts: 6
Joined: Wed Apr 18, 2012 6:12 pm
Contact:

How to make a question

#1 Post by RedLlama » Wed Jul 04, 2012 9:25 pm

How do you make a question with a inputable answer and only one reply will let you continue. Also, how do you make it continue but if you don't put the right answer something special happens?


User avatar
Showsni
Miko-Class Veteran
Posts: 563
Joined: Tue Jul 24, 2007 12:58 pm
Contact:

Re: How to make a question

#3 Post by Showsni » Thu Jul 05, 2012 2:10 am

Do you want to make menu options, or have the user type in something?

http://www.renpy.org/wiki/renpy/doc/ref ... enpy.input

Code: Select all

$ pword = renpy.input("Please enter the password.", length=7)
if not pword == "default":
    "Error! Wrong password!"
    "GAME OVER."
    return
"That was... correct! Access granted!"

RedLlama
Newbie
Posts: 6
Joined: Wed Apr 18, 2012 6:12 pm
Contact:

Re: How to make a question

#4 Post by RedLlama » Thu Jul 05, 2012 12:08 pm

I want the user to input something, but how do you make a certain response correct?

User avatar
Showsni
Miko-Class Veteran
Posts: 563
Joined: Tue Jul 24, 2007 12:58 pm
Contact:

Re: How to make a question

#5 Post by Showsni » Thu Jul 05, 2012 1:20 pm

As in my example; you can save renpy.input to a variable (in this case, pword). You can then check to see if a variable is the same as something, or if it is not the same:

if pword == "Correct":
#Do this
if not pwrd == "Correct":
#Do that

That code would check to see if what they had entered was exactly "Correct" (capitalisation counts!) and do this if it was, and do that if it wasn't.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]