Need help with implementing external script

I’m new to python and blender. I’ve been experimenting with python timer creating a count down timer using a python script.

Here is my question how do I add a pre-defined object in blender, a sphere into the game engine while the game is running live via an external script. Which works with the use of a count down timer that randomly adds item to the field with in the given time frame.

I’ve tried adding it via Enable Script Link but nothing is happening.

um…add object actuator…?why use python, me says :smiley:

hmm actually wanting to randomly spawn an object into the game randomly instead of popping it in frame constantly through the frames

That might give you a hand. Also, the add object actuator is what you’re looking for. You can use random numbers (via the random module) and only add an object on a certain number. For example:

#--Get randint from the random module
from random import randint

#--Lets make things nicer by have to type less :D
gl = GameLogic

cont = gl.getCurrentController()

#--This assumes you have an edit object actuator setup (with the object specified) and it is named add
add = cont.getActuator("add")

#--Now time to get down to the fun stuff :)
#--The following will get a random number between 1 and 5 and add the object if that number is 3
num = randint(1, 5)

if num == 3:

You’d want to hook that up to an always sensor and you’d probably want to mess with the pulse settings. Every time the always sensor fires, you get a 1 in 5 chance of the object being added.

Thanks for the help this makes a lot of sense now.
well now my blender being unfriendly to me about not recognizing gamelogic module -.-