0
$\begingroup$

My script won't execute when the game initiates.

It's just a simple "print('Hello')". It works when I click "run script" but not automatically when the game initiates. I have tried 3 different versions of Blender and still no luck.

When I used to use Blender, about 2 years ago, I remember it working fine, but for some reason it has stopped working. Is there anything I can do? Thank you.

$\endgroup$
  • 1
    $\begingroup$ Welcome to BSE! Do you have a python controller with the script selected in your game? And does it run on startup? You might want to upload a .blend because we have very little information right now $\endgroup$ – palkonimo Jul 27 '16 at 17:47
  • $\begingroup$ Have you (re)tried your script with the version of Blender it was written for at the origin ? $\endgroup$ – lemon Jul 27 '16 at 17:57
  • $\begingroup$ @palkonimo I don't think I do but I don't recall needing it, maybe I'm wrong. Here is the .blend file: filedropper.com/untitled_143 $\endgroup$ – Tom Jul 27 '16 at 18:04
  • $\begingroup$ @lemon I have tried that. $\endgroup$ – Tom Jul 27 '16 at 18:05
  • $\begingroup$ ok... you have tried that, but does it still work ? (nothing is explicitly said about that). Can you indicate the Blender version used at the origin ? $\endgroup$ – lemon Jul 27 '16 at 18:16
0
$\begingroup$

Your python script is not running because you only created it, you did not tell it to run. To do this, first open up the Logic Editor.Step 1

Then, create an Always Sensor, and a Python Controller. Set the script to be the name of your script (In this case, Text). Now, click Level on the Always Sensor, to make it run once. Step 2

Finally, connect the two blocks, and you're good to go! Step 3

Here is the result in the command line: Done

$\endgroup$
1
$\begingroup$

Your script ins't executed anywhere. If you want it to be executed at the start of your game you'll need to have an always sensor connected to a python controller having the script in it. This can be in any object. the setup

$\endgroup$
  • $\begingroup$ Thank you so much! I feel stupid lol I remember doing this now from before. $\endgroup$ – Tom Jul 27 '16 at 18:26

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.