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.
I'm not sure what I'm doing wrong. I've looked up different answers and none of them are working. I'm trying to make it so if you go on a date with Cindy, the player will say a different line in the future.
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 498, in script
if cindydate1 = True:
SyntaxError: invalid syntax (game/script.rpy, line 498)
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 498, in script
if cindydate1 = True:
File "C:\Users\Anya\Desktop\renpy-6.99.14.3-sdk\renpy\ast.py", line 1729, in execute
if renpy.python.py_eval(condition):
File "C:\Users\Anya\Desktop\renpy-6.99.14.3-sdk\renpy\python.py", line 1917, in py_eval
code = py_compile(code, 'eval')
File "C:\Users\Anya\Desktop\renpy-6.99.14.3-sdk\renpy\python.py", line 674, in py_compile
raise e
SyntaxError: invalid syntax (game/script.rpy, line 498)
Windows-8-6.2.9200
Ren'Py 6.99.14.3.3347
My Royal Love 1.0
Sun Apr 22 07:04:08 2018
if cindydate1 = True:
"I met Cinderella, who was suppose to show me around the castle. Thanks for telling me by the way..."
I'm not sure if there is other code you need? Not sure if you also need this information, but I also have other character that you can go on a date with, and depending on who you choose, the player will say different lines, but this is just the first error Renpy showed when I pressed "launch project"
if cindydate1: # or if cindydate1 == True:
"I met Cinderella, who was suppose to show me around the castle. Thanks for telling me by the way..."
Note:
You can do "if variable:" for quick variable checks - if the variable is boolean (True or False) then it'll be evaluated the same as "if variable == True". This is true for most modern programming languages, though I'm old enough to have learnt QBasic and it confused the hell out of me when I was told I could shorten it.
You can get more advanced than that with variables, such as strings to see whether they're empty or not (if string_var: would return True if string_var is not empty; False if string_var is ""). There're standard conventions in most programming languages, but always make sure to read up on the language's way of evaluating these statements
During the last code, the "I met Cinderella..." I have 2 different options of that line, depending on which character you choose to go on a date with. When I did launch project, I chose the Cinderella route (the route where youre suppose to get the line "I met Cinderella...")I would get an error for the other characters answers. If I pressed ignore, it would play Cinderella's response, then I would get an error for a different response. Should I separate these somehow?
Traceback:
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 502, in script
if alddindate1:
File "game/script.rpy", line 502, in <module>
if alddindate1:
NameError: name 'alddindate1' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 502, in script
if alddindate1:
File "C:\Users\Anya\Desktop\renpy-6.99.14.3-sdk\renpy\ast.py", line 1729, in execute
if renpy.python.py_eval(condition):
File "C:\Users\Anya\Desktop\renpy-6.99.14.3-sdk\renpy\python.py", line 1919, in py_eval
return py_eval_bytecode(code, globals, locals)
File "C:\Users\Anya\Desktop\renpy-6.99.14.3-sdk\renpy\python.py", line 1912, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/script.rpy", line 502, in <module>
if alddindate1:
NameError: name 'alddindate1' is not defined
Windows-8-6.2.9200
Ren'Py 6.99.14.3.3347
My Royal Love 1.0
Sun Apr 22 07:51:18 2018
The error is basically saying the variable alddindate1 is not defined, so somehow your code isn't reaching the "$ aladdindate1" line it seems. Try adding the following outside of a label block to initialise it at game launch: