[solved] text user input to riddle with multiple answers

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
Daseril
Newbie
Posts: 3
Joined: Tue Nov 05, 2019 10:58 am
Tumblr: Daseril
Contact:

[solved] text user input to riddle with multiple answers

#1 Post by Daseril » Tue Nov 05, 2019 11:35 am

I have a riddle in my game that has two possible answers, and it doesn't make sense to do a multiple choice menu cause then its too easy. But I can't figure out how to have the user put in the text input and then renpy checks for the two possible answers. If they get it right they proceed to the next part of the game, and if they get it wrong they get to try again until they get it right.

Code: Select all

label riddle:
                      $ answer = renpy.input ()
                      if answer == "poison", "coffin":
                          door "acceptable, you may pass"
                          jump party
                      else:
                          door "Incorrect"
                          jump riddle
and here is the exception I get when I get to that part of the game and it crashes.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 144, in script
    $ answer = renpy.input ()
  File "game/script.rpy", line 144, in <module>
    $ answer = renpy.input ()
TypeError: input() takes at least 1 argument (0 given)
I feel like I am missing something big...
Last edited by Daseril on Tue Nov 05, 2019 1:42 pm, edited 1 time in total.

User avatar
XxrenxX
Veteran
Posts: 265
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: text user input to riddle with multiple answers

#2 Post by XxrenxX » Tue Nov 05, 2019 1:36 pm

from what I understand and anyone correct as I'm no expert here, you need something in those brackets after renpy.input

So maybe just changing that one line to this would help?

Code: Select all

label riddle:
                      $ answer = renpy.input ("What is the answer?") #Prompt for user

Daseril
Newbie
Posts: 3
Joined: Tue Nov 05, 2019 10:58 am
Tumblr: Daseril
Contact:

Re: text user input to riddle with multiple answers

#3 Post by Daseril » Tue Nov 05, 2019 1:41 pm

oh wow yeah, that was it. all I needed to do was put something in the brackets there! lol I rewrote this one code block like 4 different ways and it was as simple as that. thank you!

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot]