Unexpected token error


#1

Working HUNTER TRIPLET

My code might not be right overall, but what, specifically, is causing this error?

Error:
Put each command on its own line.
Unexpected token

Code:

if (enemy) {
    if (self.attackRange < self.distanceTo(enemy.pos)) {
    self.say("Charge")
    self.setAction('move')
    } else {
    self.setAction("attack")
    self.say("Kill")
    }
}

Thanks for the help!


#2

What language are you doing? It sounds like you have the curly braces from JavaScript, but the self and no semicolons from Python. I’d try hovering over the if/else docs to check out the example of what the syntax for your language should be like.


#3

That’s it. I pasted in scripts from the wrong place and didn’t adapt them. Thanks.


#4

Ha ha. LOL, i’ve had the same problem.