2
$\begingroup$

enter image description hereFolks 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 ! enter image description here

$\endgroup$
  • $\begingroup$ When you use windows,what error pops in "Windows-->Toggle system console" ? $\endgroup$ – Lev May 4 '15 at 11:13
  • $\begingroup$ "Toggle system console" works fine / is present in the windows version, however on another recent tutorial there is still no motion. This tutorial was posted for 2.7 - I am using 2.7.1 $\endgroup$ – DPR-treasureIsland May 5 '15 at 14:05
  • $\begingroup$ Upload your blend file here: pasteall.org/blend and edit your original question with it. You are not giving us any error report so far. Like what are you trying to do with the script? $\endgroup$ – Lev May 5 '15 at 14:11
  • $\begingroup$ I think what you mean by "pulse" is True level triggering. $\endgroup$ – Scalia May 6 '15 at 16:07
  • 1
    $\begingroup$ you need a colon: after the if statement if something : $\endgroup$ – Chebhou May 7 '15 at 1:57
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.