Page 1 of 1
(Solved) getting invalid syntax
Posted: Tue Aug 20, 2019 6:09 pm
by texasstallion
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 732, in script
if g3_point <=5 :
SyntaxError: invalid syntax (game/script.rpy, line 734)
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 732, in script
if g3_point <=5 :
File "C:\Users\d5.d257\Downloads\renpy-7.3.2-sdk\renpy\ast.py", line 1830, in execute
if renpy.python.py_eval(condition):
File "C:\Users\d5.d257\Downloads\renpy-7.3.2-sdk\renpy\python.py", line 2033, in py_eval
code = py_compile(code, 'eval')
File "C:\Users\d5.d257\Downloads\renpy-7.3.2-sdk\renpy\python.py", line 690, in py_compile
raise e
SyntaxError: invalid syntax (game/script.rpy, line 734)
Windows-8-6.2.9200
Ren'Py 7.3.2.320
jo 1.0
Tue Aug 20 17:04:23 2019
Code: Select all
label bethtalk:
hide scienceTeacher
show beth_happy
if g3_point <=5 :
jump bethtalkintro
elif g3_point >=5 and if g3_point <=20 :
jump bethtalk1
elif g3_point >=20 and if g3_point <60 :
jump bethtalk2
elif g3_point >=60 and if g3_point <100 :
jump bethtalk3
elif g3_point >=100 and if g3_point <150 :
jump bethtalk4
elif g3_point >=150 and if g3_point <200 :
jump bethtalk5
elif g3_point >=200 and if g3_point <10000 :
jump bethtalk6
else:
jump science1
Re: getting invalid syntax
Posted: Tue Aug 20, 2019 11:34 pm
by rayminator
take out the < use a + or - I don't think using < will do anything at all but give errors haven't seen anybody using that in their games before
this might be wrong as well
just to let you know that I'm only at a beginners level so I might be wrong.
Code: Select all
elif g3_point += 200 and if g3_point = 10000:
elif g3_point -= 200 and if g3_point = 10000:
Re: getting invalid syntax
Posted: Wed Aug 21, 2019 12:06 am
by namastaii
Uh, well.. += and -= is for increasing and decreasing a numeric variable. A <= or >= is saying "less than or equal to" or "greater than or equal to" - it is a comparison command.
You have some improper indentation and spacing.
Code: Select all
label bethtalk:
hide scienceTeacher
show beth_happy
if g3_point <=5:
jump bethtalkintro
elif g3_point >=5 and if g3_point <=20:
jump bethtalk1
elif g3_point >=20 and if g3_point <60:
jump bethtalk2
elif g3_point >=60 and if g3_point <100:
jump bethtalk3
elif g3_point >=100 and if g3_point <150:
jump bethtalk4
elif g3_point >=150 and if g3_point <200:
jump bethtalk5
elif g3_point >=200 and if g3_point <10000:
jump bethtalk6
else:
jump science1
Re: getting invalid syntax
Posted: Wed Aug 21, 2019 3:43 am
by drKlauz
Remove extra ifs from conditions.
Code: Select all
if g3_point <=5 :
jump bethtalkintro
elif g3_point >=5 and g3_point <=20 :
jump bethtalk1
...
else:
jump science1
Also it may be easier to read next way:
Code: Select all
if g3_point<=5:
jump bethtalkintro
elif 5<g3_point<=20:
jump bethtalk1
...
else:
jump science1
Re: getting invalid syntax
Posted: Wed Aug 21, 2019 9:53 am
by rayminator
namastaii wrote: ↑Wed Aug 21, 2019 12:06 am
Uh, well.. += and -= is for increasing and decreasing a numeric variable. A <= or >= is saying "less than or equal to" or "greater than or equal to" - it is a comparison command.
Oh okay that's for clearing that out for me I wasn't 100% sure
thanks
Re: getting invalid syntax
Posted: Wed Aug 21, 2019 5:28 pm
by texasstallion
Thanks everyone, removing the extra if was the cause. Also fixed the indentation, the indentations were only like that because i was trying to find out where i messed up and thought it was because they were not spouse to be together.