How to make a question
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.
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.
How to make a question
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?
-
apricotorange
- Veteran
- Posts: 479
- Joined: Tue Jun 05, 2012 2:01 am
- Contact:
Re: How to make a question
Do you want to make menu options, or have the user type in something?
http://www.renpy.org/wiki/renpy/doc/ref ... enpy.input
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!"Re: How to make a question
I want the user to input something, but how do you make a certain response correct?
Re: How to make a question
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.
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.
Who is online
Users browsing this forum: Bing [Bot]