If statements

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
thedarkdefender
Regular
Posts: 97
Joined: Fri Jan 13, 2012 11:13 am
Projects: TBTR
Organization: Clockwork Cafe
Location: Narnia
Contact:

If statements

#1 Post by thedarkdefender »

At first, I encountered no problems when I ran the game. When I tried for the second path, and retried the previous path this is what I got:

Code: Select all

While running game code:
  File "game/script.rpy", line 1135, in script
            if think = "toclear":
SyntaxError: invalid syntax (game/script.rpy, line 1135)

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "E:\Documents and Settings\JuVy 2\My Documents\Downloads\Random\VNs\renpy-6.13.7\renpy\execution.py", line 261, in run
  File "E:\Documents and Settings\JuVy 2\My Documents\Downloads\Random\VNs\renpy-6.13.7\renpy\ast.py", line 1366, in execute
  File "E:\Documents and Settings\JuVy 2\My Documents\Downloads\Random\VNs\renpy-6.13.7\renpy\python.py", line 1015, in py_eval
  File "E:\Documents and Settings\JuVy 2\My Documents\Downloads\Random\VNs\renpy-6.13.7\renpy\python.py", line 260, in py_compile
SyntaxError: invalid syntax (game/script.rpy, line 1135)
I'm not an expert when it comes to coding, so I'm really confused.
Help? :oops:
Image

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: If statements

#2 Post by apricotorange »

In Python, equality uses two equals signs, "==".

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

Re: If statements

#3 Post by Alex »

For comparison you need to use double-equal sign

Code: Select all

if think == "toclear":

User avatar
thedarkdefender
Regular
Posts: 97
Joined: Fri Jan 13, 2012 11:13 am
Projects: TBTR
Organization: Clockwork Cafe
Location: Narnia
Contact:

Re: If statements

#4 Post by thedarkdefender »

I actually tried that, and it didn't work. The weird thing is it works perfectly now :confused:
Image

Post Reply

Who is online

Users browsing this forum: Bing [Bot]