Name Error: name [variable] is not defined (but it is?)[SOLVE:D]

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
PeachStar1
Newbie
Posts: 6
Joined: Mon Apr 12, 2021 8:18 am
itch: PeachStarStudios
Contact:

Name Error: name [variable] is not defined (but it is?)[SOLVE:D]

#1 Post by PeachStar1 » Sun May 16, 2021 9:16 pm

So uhh help

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 181, in script
    if $RobinRel >= 2:
SyntaxError: invalid syntax (script.rpy, line 181)

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

Full traceback:
  File "game/script.rpy", line 181, in script
    if $RobinRel >= 2:
  File "/Users/flckl/Desktop/renpy-7.4.0-sdk/renpy/ast.py", line 1843, in execute
    if renpy.python.py_eval(condition):
  File "/Users/flckl/Desktop/renpy-7.4.0-sdk/renpy/python.py", line 2140, in py_eval
    code = py_compile(code, 'eval')
  File "/Users/flckl/Desktop/renpy-7.4.0-sdk/renpy/python.py", line 746, in py_compile
    raise e
SyntaxError: invalid syntax (script.rpy, line 181)

Code: Select all

    r "Well, we're finished!"
    pause
    r "What do you guys think?"
    pause
    if RobinRel >= 2:
        jump Robinlikesursong
    elif AntRel >= 2:
        jump Antlikesursong
    elif SkyRel >= 2:
        jump Skylikesursong
    elif RobinRel == 1 and AntRel == 1 and SkyRel == 1:
        jump alllikeursong
       
I don't know what I can do? Help I really want to release the demo of this game!
Last edited by PeachStar1 on Mon May 17, 2021 11:30 am, edited 1 time in total.

User avatar
mavyxdawn
Regular
Posts: 67
Joined: Sun Dec 20, 2015 6:18 pm
Github: mavyxdawn
itch: zeillearnings
Discord: Zeil#4950
Contact:

Re: Name Error: name [variable] is not defined (but it is?)

#2 Post by mavyxdawn » Sun May 16, 2021 9:27 pm

It says invalid syntax but the syntax is correct. Did you create RobinRel correctly?

Code: Select all

default RobinRel = 0
Edit: Maybe you could also add the error from your title? "Name Error: name [variable] is not defined"
YouTube: Zeil Learnings
itch.io: Zeil Learnings

Image

PeachStar1
Newbie
Posts: 6
Joined: Mon Apr 12, 2021 8:18 am
itch: PeachStarStudios
Contact:

Re: Name Error: name [variable] is not defined (but it is?)

#3 Post by PeachStar1 » Sun May 16, 2021 9:40 pm

Thank you this fixed the problem!

User avatar
mavyxdawn
Regular
Posts: 67
Joined: Sun Dec 20, 2015 6:18 pm
Github: mavyxdawn
itch: zeillearnings
Discord: Zeil#4950
Contact:

Re: Name Error: name [variable] is not defined (but it is?)

#4 Post by mavyxdawn » Sun May 16, 2021 10:13 pm

nice! You're welcome :D
YouTube: Zeil Learnings
itch.io: Zeil Learnings

Image

Post Reply

Who is online

Users browsing this forum: No registered users