BGE script error: Invalid Syntax I've been dabbling in Blender's Game Engine, so I thought it was time to take it to the next level and use scripts to control my game, but now I have a problem; I keep getting this error (only printing error message):

mainScript.py, line 28
   if PlayerControls.playerMain['isInCover'] == 0
                                                ^
SyntaxError: invalid syntax
location: &lt;unknown location&gt;:-1


My code:

def toggleProne():
  if PlayerControls.playerMain['isInCover'] == 0
      PlayerControls.playerMain['isCrouched'] = 0
      PlayerControls.playerMain['isStanding'] = 0
      PlayerControls.playerMain['isProne'] = 1
  return;


Removing the if-statement and adjusting the indentation (as a result of the removed if-statement) allows the code to be compiled - until it finds the next if statement and errors out.
To write an if statement in python you need a colon at the end of the condition then the rest gets indented.
Like this

if a == b:
    print("yep")


So your code would be like this.

def toggleProne(): 
    if PlayerControls.playerMain['isInCover'] == 0:
        PlayerControls.playerMain['isCrouched'] = 0
        PlayerControls.playerMain['isStanding'] = 0
        PlayerControls.playerMain['isProne'] = 1
    return;


Personally, I would use a var for PlayerControls.playerMain, it would save you from having that whole thing four times.