How to connect conditions[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
electragurl
Regular
Posts: 37
Joined: Sat Jul 20, 2013 12:21 pm
Contact:

How to connect conditions[SOLVED]

#1 Post by electragurl » Sat Jul 20, 2013 12:32 pm

This is probably a really stupid question, but I can't figure out how to connect several conditions.
This is my code, but when I get to this part the blue screen pops up and says invalid syntax.

Code: Select all

if books == True and if tv == True and if record == True and if $ snowglobe == True:
            show calypso talking
            c "You have such cool stuff in your room, Everett."
Oh, and if anyone wants the full traceback:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 472, in script
SyntaxError: invalid syntax (game/script.rpy, line 472)

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

Full traceback:
  File "C:\Users\Dennis\Desktop\renpy-6.15.5-sdk\renpy\execution.py", line 288, in run
    node.execute()
  File "C:\Users\Dennis\Desktop\renpy-6.15.5-sdk\renpy\ast.py", line 1484, in execute
    if renpy.python.py_eval(condition):
  File "C:\Users\Dennis\Desktop\renpy-6.15.5-sdk\renpy\python.py", line 1331, in py_eval
    return eval(py_compile(source, 'eval'), globals, locals)
  File "C:\Users\Dennis\Desktop\renpy-6.15.5-sdk\renpy\python.py", line 450, in py_compile
    raise e
SyntaxError: invalid syntax (game/script.rpy, line 472)
Thanks so much for your time:D
Last edited by electragurl on Thu Jul 25, 2013 4:05 pm, edited 1 time in total.

User avatar
jghibiki
Regular
Posts: 125
Joined: Wed Sep 19, 2012 9:08 pm
Projects: Dream's Dénouement, Unannounced RPG framework, Renpy-Safe Logger
Organization: Team Anarky
IRC Nick: jghibiki
Location: Minnesota, US
Contact:

Re: How to connect conditions

#2 Post by jghibiki » Sat Jul 20, 2013 12:37 pm

you almost have it just omit the second "if" in the comparison statement and get rid of the $ before snowglobe e.g.

Code: Select all

if books == True and tv == True and record == True and snowglobe == True:
            show calypso talking
            c "You have such cool stuff in your room, Everett."
_______________________________________
jghibiki
Web/Twitter/Tumblr

User avatar
electragurl
Regular
Posts: 37
Joined: Sat Jul 20, 2013 12:21 pm
Contact:

Re: How to connect conditions

#3 Post by electragurl » Sat Jul 20, 2013 12:42 pm

jghibiki wrote:you almost have it just omit the second "if" in the comparison statement and get rid of the $ before snowglobe e.g.

Code: Select all

if books == True and tv == True and record == True and snowglobe == True:
            show calypso talking
            c "You have such cool stuff in your room, Everett."
Thanks you! :D What a stupid mistake...this helps a lot!!

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: How to connect conditions

#4 Post by xavimat » Sat Jul 20, 2013 2:16 pm

And there is a simpler way. When you need to check if a variable is True, is the same to check with "variable == True" or only with "variable". Then:

Code: Select all

if books and tv and record and snowglobe:
        show calypso talking
        c "You have such cool stuff in your room, Everett."
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
electragurl
Regular
Posts: 37
Joined: Sat Jul 20, 2013 12:21 pm
Contact:

Re: How to connect conditions[SOLVED]

#5 Post by electragurl » Thu Jul 25, 2013 4:26 pm

That makes it so much easier:) thank you all for such helpful feedback.
"Yesiree, the future's looking very bright indeed!"

Post Reply

Who is online

Users browsing this forum: enaielei