Get all actuators

I am using Python, and am looking for a method to get all actuators in a scene…

Can you get all actuators in a scene?
something like scene.getActuators()

or… Can logic brick connections be made using a script?
something like owner.getActuators()

I’ve been using the controller method, getActuators() which gets a list of all the connected actuators. I then use for act in actuators to cycle through all the actuators. Its working great.

My problem boils down to the fact that when I duplicate objects connected to the python script, they aren’t connected by default. This means every new object has to be connected. Its a LOD script, its working great, and I intend to use it on nearly every object in the game. Its a huge amount of work to connect them by hand.

Can you get actuators through a object rather than a controller. I can get the whole scenew, and I can get an object from the scene, I just can’t get to its actuators.

Any help appreciated.

##########Here’s the script, if anyones curious####
#AirSpeedAuto LOD script

import GameLogic as ga
import string as string

co = ga.getCurrentController()

acts = co.getActuators()
print acts

for act in acts:
print “Actuator name:” + act.getName()
if act.getName() == “LOD”:
ob = act.getOwner()
cam = ga.getCurrentScene().active_camera
print “Camera’s name is:” + cam.name
def Depth(pos, plane):
return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3]

	depth = Depth(ob.position, cam.world_to_camera[2])
	print "Depth is:"
	print depth

	try:
		lodX = ob.lodAdjust
		nothing = 0
		print "lodX is:"
		print lodX
	except:
		lodX= 1

	if depth > -20*lodX:
		newLod = "_LodH"
	elif depth > -80*lodX:
		newLod = "_LodM"
	else:
		newLod = "_LodL"


	name = ob.getName()
	print "Object name:" + name
	length =len(name)
	print length
	stripname = name[2:length-4]
	
	print "Stripped Object name:" + stripname
	meshName = stripname + newLod
	print "LOD Object name:" + meshName
	
	act.setMesh(meshName)
	ga.addActiveActuator(act,1)

Thanks,

Joe

you can only get actuators and sensors that a controller [which your python script is run from] is linked to

you can’t get actuators and sensors from an object, at least in the 2.25 api [I haven’t played with the new one]

I noticed this script in the game reference that is set for an individual object for level of detail. Might be pretty tough to use on a complex game world.

http://www.blender.org/modules/documentation/pydoc_gameengine/PyDoc-Gameengine-2.34/KX_SCA_ReplaceMeshActuator.KX_SCA_ReplaceMeshActuator-class.html

How about connecting all the actuators to one controller?