A Question about Text In-put [SOLVED]

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
User avatar
aussieducky
Regular
Posts: 31
Joined: Sat Dec 27, 2014 8:43 pm
Projects: =
Tumblr: aussiebunny
Contact:

A Question about Text In-put [SOLVED]

#1 Post by aussieducky »

So I know you can use text in-put to name a character, but can you use it to answer questions? In my game, I want the player to solve puzzles by typing in words and numbers. The answers are going to be very simple - no sentences. Is this possible? :0
Last edited by aussieducky on Mon May 18, 2015 1:00 am, edited 1 time in total.
I am a teenager who would like, very much, to finish a visual novel ;D

I don't know much about coding, but I'll try not to be a bother.

Currently working on: "Blackout"

User avatar
Alera
Miko-Class Veteran
Posts: 651
Joined: Sun Mar 21, 2010 3:20 am
Completed: Tortichki // Zayay // Hero's Spirit
Deviantart: psyalera
itch: psyalera
Location: UK
Contact:

Re: A Question about Text In-put

#2 Post by Alera »

That is entirely possible! The Doll's stories is one game I can think of that uses the text input quite extensively. But you can use it for simpler things as well.

The simplest way to do this is:

Code: Select all

    $ answer = renpy.input(_("What is your answer?")) 
    
    "My answer is [answer]." 
    
    if answer =="Correct Answer": #change to whatever the answer of the riddle is
        "You're correct!"
    else:
        "You're wrong!"
This topic: http://lemmasoft.renai.us/forums/viewto ... =8&t=29320 has quite a bit of information in it, if you skip the parts about making the actual keyboard, you can find out a lot about setting up passwords and specific answers. Like for example, you can set it so that the input only accepts numbers or specific characters.
Image
Games:
❤️ Zayay [Otome?][BxPlayer][NaNo 2013]
❤️ Tortichki [Drag&Drop mini game]

Other games I've worked on:
My Heart's Flame Emissary of Starlight Freedom From Silence Sickness
And many more unannounced/secret projects. (. .)

User avatar
aussieducky
Regular
Posts: 31
Joined: Sat Dec 27, 2014 8:43 pm
Projects: =
Tumblr: aussiebunny
Contact:

Re: A Question about Text In-put

#3 Post by aussieducky »

Alera wrote:That is entirely possible! The Doll's stories is one game I can think of that uses the text input quite extensively. But you can use it for simpler things as well.

The simplest way to do this is:

Code: Select all

    $ answer = renpy.input(_("What is your answer?")) 
    
    "My answer is [answer]." 
    
    if answer =="Correct Answer": #change to whatever the answer of the riddle is
        "You're correct!"
    else:
        "You're wrong!"
This topic: http://lemmasoft.renai.us/forums/viewto ... =8&t=29320 has quite a bit of information in it, if you skip the parts about making the actual keyboard, you can find out a lot about setting up passwords and specific answers. Like for example, you can set it so that the input only accepts numbers or specific characters.
Thank you so much! This works perfectly! :D
I am a teenager who would like, very much, to finish a visual novel ;D

I don't know much about coding, but I'll try not to be a bother.

Currently working on: "Blackout"

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]