Adressing unique objects created via Edit Object

I am toying with the Add function in Edit Objects. Got some cubes that create moving spheres when I click Space, the usual stuff. Then I added some mouse function and found that I can have the created objects react separately; I click one, it moves. Click another, it moves. Clearly, objects thus created in-game can be handled as unique objects!

However, how do I explain to the game that I want, say, the Sphere that was created third by a Cube to do something, without using mouse functions? Imagine it: The cube creates five spheres. I want to tell the computer to move the third sphere, and only the third, 2.00 on the X axis.

How? :spin:

And if someone out there is really good: With the mouse-clicking experiment, I found that I can click on each sphere and change a property stored in it. That means that I could, for example, switch a boolean on or off in one specific created sphere. What other ways do I have of doing that, if not using the mouse?

Attach script to object started by always sensor (pulse off). This script will be executed in a moment, when object is added to scene. Perform registration to global array in this script.


if hasattr(GameLogic, 'objects') == 0:
  GameLogic.objects = []

Now you can access any of registered object in any script in the game.

# moving the third object 2 unix in X axis
pos = GameLogic.objects[2].getPosition()
pos[0] += 2

you can also access them via thier object names in python but you have to do the dynamic name generation on your own, here is a script I made to do just that.

#Dynamic Name Generator by Siegel

import GameLogic as G

C = G.getCurrentController()
O = C.getOwner()
actAddOb = C.getActuator('addOb')
senAKey = C.getSensor('aKey')
obList = G.getCurrentScene().getObjectList()
nameList = []

for ob in obList:
    addingObject = actAddOb.getObject()

if senAKey.isPositive():
    newName = nameList.count(addingObject)+1
    actAddOb.getLastCreatedObject().name = addingObject+str(newName)

Uuuh, yummy stuff! Is there any documentation on this to let me dig deeper into the posibilities? GE documentation still seems hard to find…