SyntaxError: invalid syntax (<none>, line 1)
Posted: Fri May 07, 2021 7:00 am
Hello, I'm trying to declare an image which has an idle and active modes and I'm using a conditionswitch to change the image from idle to active. and vice versa. But I also want the image to be random. The images are 4 different arrows. and each time I want a different random arrow. Like this
This is the code I'm using
But I'm getting an error
I'm close to giving up on this minigame. If you guys can find out what i'm doing wrong I would be really grateful. Thank you!
This is the code I'm using
Code: Select all
label fightvariables:
$ RandomFirst = renpy.random.randint(0, 3)
if RandomFirst == 0:
$ arrow_one = arrow_down
$ ArrowOne = ArrowDown
elif RandomFirst == 1:
$ arrow_one = arrow_up
$ ArrowOne = ArrowUp
elif RandomFirst == 2:
$ arrow_one = arrow_right
$ ArrowOne = ArrowRight
elif RandomFirst == 3:
$ arrow_one = arrow_left
$ ArrowOne = ArrowLeft
return
label Beforefighting:
call fightvariables
image ArrowOne = ConditionSwitch (
"[ArrowOne]Active == True", "fighting/arrows/[arrow_one]_active.png",
"True", "fighting/arrows/[arrow_one]_idle.png")
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/fight.rpy", line 5, in script
image ArrowOne = ConditionSwitch (
File "game/fight.rpy", line 5, in script
image ArrowOne = ConditionSwitch (
File "game/fight.rpy", line 7, in <module>
"True", "fighting/arrows/[arrow_one]_idle.png")
SyntaxError: invalid syntax (<none>, line 1)
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/bootstrap.py", line 326, in bootstrap
renpy.main.main()
File "renpy/main.py", line 515, in main
renpy.game.context().run(node)
File "game/fight.rpy", line 5, in script
image ArrowOne = ConditionSwitch (
File "game/fight.rpy", line 5, in script
image ArrowOne = ConditionSwitch (
File "renpy/ast.py", line 1021, in execute
img = renpy.python.py_eval_bytecode(self.code.bytecode)
File "renpy/python.py", line 2242, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/fight.rpy", line 7, in <module>
"True", "fighting/arrows/[arrow_one]_idle.png")
File "renpy/display/layout.py", line 1472, in ConditionSwitch
code = renpy.python.py_compile(cond, 'eval')
File "renpy/python.py", line 835, in py_compile
raise e
SyntaxError: invalid syntax (<none>, line 1)
Windows-8.1-6.3.9600
Ren'Py 7.4.4.1439
conditionswitch 1.0
Fri May 7 16:14:26 2021