[SOLVED]Why am I getting "SyntaxError: invalid syntax" here?

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
Jae
Regular
Posts: 192
Joined: Sun Sep 13, 2015 5:41 pm
Projects: Pokémon Academy Life
Location: New York, NY
Contact:

[SOLVED]Why am I getting "SyntaxError: invalid syntax" here?

#1 Post by Jae » Sat Jan 16, 2016 9:00 pm

I'm silly. Solved.

----------


This just boggles me. I never had an issue with basic if/else statements, but for some reason this just doesn't work?

CODE:

Code: Select all

label elective_intro:
    show classroom:
        alpha 0.0
        linear 1.0 alpha 1.0

    if redtype1 == "Bug":
        show bugtype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Dark":
        show darktype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Dragon":
        show dragontype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Electric":
        show electype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Fairy":
        show fairytype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Fighting":
        show fighttype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Fire":
        show firetype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0
        
    elif redtype1 == "Flying":
        show flytype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Ghost":
        show ghosttype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Grass":
        show grasstype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Ground":
        show groundtype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Ice":
        show icetype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Normal":
        show normtype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Poison":
        show poisontype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Psychic":
        show psychtype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 = "Rock":
        show rocktype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Steel":
        show steeltype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0

    elif redtype1 == "Water":
        show watertype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0
    
    show red norm uni at replace:
        xpos 2500 ypos 2000
ERROR:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/elective_classes01.rpy", line 29, in script
    if redtype1 == "Bug":
SyntaxError: invalid syntax (game/elective_classes01.rpy, line 104)
Lines 29-32:

Code: Select all

    if redtype1 == "Bug":
        show bugtype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0
Lines 104-107:

Code: Select all

    elif redtype1 = "Rock":
        show rocktype:
            alpha 0.0 xalign 0.5 yalign 1.0
            linear 0.5 alpha 1.0
Variables are all defined prior to running these lines in another script, different scene.

What's incredibly odd is that if I delete lines 29-32 and replace it with subsequent lines (replaced "elif" with "if") the traceback still reports the original lines 29-32 as if I never saved the script.
Last edited by Jae on Sat Jan 16, 2016 9:11 pm, edited 1 time in total.

User avatar
Zetsubou
Miko-Class Veteran
Posts: 513
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Why am I getting "SyntaxError: invalid syntax" here?

#2 Post by Zetsubou » Sat Jan 16, 2016 9:08 pm

Maybe unrelated, but:

Code: Select all

elif redtype1 = "Rock":
You're missing an equals.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

Image

User avatar
Jae
Regular
Posts: 192
Joined: Sun Sep 13, 2015 5:41 pm
Projects: Pokémon Academy Life
Location: New York, NY
Contact:

Re: Why am I getting "SyntaxError: invalid syntax" here?

#3 Post by Jae » Sat Jan 16, 2016 9:10 pm

Zetsubou wrote:Maybe unrelated, but:

Code: Select all

elif redtype1 = "Rock":
You're missing an equals.
Image

Completely related. I was so hung up on the code around there that I didn't scroll down.

Post Reply

Who is online

Users browsing this forum: _ticlock_