Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Strange Python Syntax Error

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 boogyman19946   Members   

1484
Like
0Likes
Like

Posted 17 January 2012 - 07:42 PM

I've been rewriting my code to use an already existing scripting language as opposed to extending the one I already had and I'm about to give it a run for the first time but I'm facing a strange issue.

The script interpreter is throwing an exception complaining about character mismatch which doesn't really make sense. Here is the exact error line as returned to me by the JVM:
Exception in thread "main" SyntaxError: ("mismatched character 's' expecting '='", ('<iostream>', 44, 49, '\t\t\tif (GlobalStatesAndVariables.keys[index] and !self.mProcessedKeys[index]):\n'))

and here is the allegedly offending code:


def ProcessKeys(self):
    for i in range(MotionModule.NUM_OF_IDS):
        if self.keyMappings[i] == GlobalStatesAndVariables.NULL:
            continue

        index = self.keyMappings[i]
        if (GlobalStatesAndVariables.keys[index] and !self.mProcessedKeys[index]): # the error points between 'n' and 'd' of the first index variable
            self.mEntity.mMotionModule.SetMotion(i, true)
            self.mProcessedKeys[index] = true
        elif (!GlobalStatesAndVariables.keys[index] and self.mProcessedKeys[index]):
            self.mEntity.mMotionModule.SetMotion(i, false)
            self.mProcessedKeys[index] = false

I can't put my finger on what the interpreter is complaining about. Any ideas?

#2 SiCrane   Moderators   

11815
Like
2Likes
Like

Posted 17 January 2012 - 08:30 PM

Python uses not for logical not instead of !.

#3 boogyman19946   Members   

1484
Like
0Likes
Like

Posted 17 January 2012 - 08:36 PM

oh man, I feel really dumb for not being aware of that. It would've taken me a good wall-headbutt or two before noticing that one. Thanks SiCrane!




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.