If staement/input Help!

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
gdf
Newbie
Posts: 11
Joined: Thu Jan 18, 2018 3:57 pm
Contact:

If staement/input Help!

#1 Post by gdf »

$ Theme_one = renpy.input
$ Theme_one = Theme_one.strip()
if Theme_one == "nothing":
s "Okay"
This is my games code,well a small part of the code,so I wanted the the player to be able to type in aword/theme and different theme gets a different answer,When I launch the project my 3rd line in this part of the code is wrong and it says this:
if statement expects an un-empty block
what shoudl I do to fix this

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: If staement/input Help!

#2 Post by Alex »

Extra indent next line, like

Code: Select all

if Theme_one == "nothing":
    s "Okay"

gdf
Newbie
Posts: 11
Joined: Thu Jan 18, 2018 3:57 pm
Contact:

New problem

#3 Post by gdf »

A new problem :
While running game code:
File game/script.rpy,line 31, in script
$ Theme_one.strip()
File game/script.rpy,line 31,in <module>
$ Theme_one=Theme_one.strip()
Attribute error : "function" object has no attribute "strip"

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: If staement/input Help!

#4 Post by Alex »

Code: Select all

$ Theme_one = renpy.input() # you've missed the brackets
https://www.renpy.org/doc/html/input.html#renpy.input

gdf
Newbie
Posts: 11
Joined: Thu Jan 18, 2018 3:57 pm
Contact:

Re: If staement/input Help!

#5 Post by gdf »

Like this?
$ Theme_one = renpy.input()
$ Theme_one = Theme_one.strip()
if Theme_one == "nothing":
s "Okay"

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: If staement/input Help!

#6 Post by trooper6 »

Put your code in-between the [ code][ /code] tags (without the extra space), so we can see your indents.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

gdf
Newbie
Posts: 11
Joined: Thu Jan 18, 2018 3:57 pm
Contact:

Re: If staement/input Help!

#7 Post by gdf »

Can you tell me how to code should go?
Correct the code:
$ Theme_one = renpy.input()
$ Theme_one = Theme_one.strip()
if Theme_one == "nothing":
s "Okay"
Its written liek that exactly

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: If staement/input Help!

#8 Post by Remix »

Indent any child of a block (lines with : at the end).

If posting code, follow trooper6's advice, use code tags -> [code]Your code here[/code]

Otherwise, the only replies you will likely get are ones saying 'indent properly' or 'use indentation'...
Frameworks & Scriptlets:

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: If staement/input Help!

#9 Post by Alex »

Try this (should work).

Code: Select all

# The game starts here.
label start:
    $ Theme_one = renpy.input("")
    $ Theme_one = Theme_one.strip()
    if Theme_one == "nothing":
        s "Okay"
    else:
        s "[Theme_one]"

gdf
Newbie
Posts: 11
Joined: Thu Jan 18, 2018 3:57 pm
Contact:

Re: If staement/input Help!

#10 Post by gdf »

Thanks

Post Reply

Who is online

Users browsing this forum: Google [Bot]