Folks I have spent many hours trying to get out of the starting gate, there are many nice tutorials which step through using python scripting in the game engine (three I have tried - which claim to be starters(. As yet I have not gotten anything to respond. Ok not completely true on a windows machine I was able to get a print out (not in the python console window but in a console which was generated on running the game engine) - I work on either linux or windows machines and yet the tutorials never seem to get even the most basic response (move a block with a key) using python. This has not been a problem with the logic blocks. I save the named script which I try to create to test, I set up an always block which is wired to the python script which is in turn seen and selected in a control block - I am in "pulse mode" (continual looping sort of correct?) but still nothing ever moves or responds.... As an aside In linux under the window tab there is no toggle system console option and no second console log pops up upon running the game engine, and the system terminal does not seem to be the place and the python console window option does not seem to be tied to bge ....It feels like something very simple is missing but darn if I can tell what it is.... Thanks Addition Below is one screen shot to address a comment and provide perspective the sphere is just for reference and not used. The console in this case gives a syntax error - The same error occurs when I change the name of the control object from own to Cube to as shown Player...... THANKS !
1 Answer
The show console menu is only available on windows, on other systems you start blender from a terminal window to see the same output as the windows console.
Programming languages are very strict when it comes to interpreting the code you give them. As Chebhou pointed out, you are missing a :
at the end of the if statement, you also have an extra [
before the keyboard.events
. Any small error like this will prevent the script from working.
The error you got says there is an error on line 11, many times it is a line or two before that that has the mistake that needs to be fixed. In this case it says the player.applyMovement()
is incorrect because it doesn't fit in what it accepts next, it wants either a :
to end the if
statement or a boolean operator like and
to join the function result with the previous test condition.
:
after the if statementif something :
$\endgroup$