Inavlid Syntax - Please 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
JustAlexander
Newbie
Posts: 21
Joined: Sun Mar 03, 2019 9:27 am
Contact:

Inavlid Syntax - Please Help

#1 Post by JustAlexander »

So... I'm new here. I make an account here mostly because I had a problem with this and I couldn't help ANYWHERE.

The problem is very simple - In my new game at some point in the game the player has to write a "special code" (It isn't special, it just part of joke. It doesn't matter what they write.) and I decided to use renpy input there... And I got a problem. I don't know where it comes from, I used the code from tutorial, letter for letter IT'S ALMOST EXACLY THE SAME and it doesn't work.

Here's how it looks:

Code: Select all

python:
	scode = renpy.input("What's the code?")

	scode = scode or "I Don't Know"
Renpy doesn't seem to have problem with that part. However, later says the problem lays in another line:

Code: Select all

"So the code is [scode]?"
it says the syntax is invalid. I tried using only [scode] but it also doesn't work. Is there some step I'm missing?

also sorry for my english. I could make a few mistakes.

EDIT: I decided to remove the second line (The one that says "So the code is [scode]?"), and everything seems to work...
So, now I know that there isn't any problem with the renpy input, but I still don't know what causes the problem with syntax.

EDIT NUMBER TWO

I'm feeling so stupid right now.
I finally discovered what was wrong with my code.
I forgot to mention it looked like this:

Code: Select all

python:
	scode = renpy.input("What's the code?")

	scode = scode or "I Don't Know"
	
	"So the code is [scode]?"
	
while it should look like this:

Code: Select all

python:
	scode = renpy.input("What's the code?")

	scode = scode or "I Don't Know"
	
"So the code is [scode]?"
	
I'm so sorry for wasting your time everyone! I'm just new and don't understand some things...
Last edited by JustAlexander on Fri Mar 08, 2019 4:31 pm, edited 3 times in total.

User avatar
Enchant00
Regular
Posts: 136
Joined: Tue Jan 12, 2016 1:17 am
Contact:

Re: Inavlid Syntax - Please Help

#2 Post by Enchant00 »

You forgot your quotations in your renpy.input which is why it probably can't reference scode.

Code: Select all

python:
	scode = renpy.input("What's the code?")

	scode = scode or "I Don't Know"
If that doesn't work, it's probably that your screen is defining a variable in a local setting. You can simply use store.scode if it need to be global.

JustAlexander
Newbie
Posts: 21
Joined: Sun Mar 03, 2019 9:27 am
Contact:

Re: Inavlid Syntax - Please Help

#3 Post by JustAlexander »

Actually I just forgot to put quatations there! Sorry!
Also I tried "store.scode" but it also doesn't work.

But thank you for help!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]