Logic brick search

You know what would be a good feature.A search for a particularly named group of sensors and actuator from a search.So that it would bre easier to find which one you want.I wonder how would you would do that though?

You can write Python code that displays the logic brick names and the associated game object names.

Have a look at the Analyzer it shows you the names of the scene. You can easily add the names of the logic bricks.

Finally what you are looking for is pretty straight forward. Loop through the objects of the scene. Loop through their logic bricks and collect them by name.

import bge

#--- bge callable
def demoPrintSensorOwner(cont):
  sensorName = "Always"
  sensors = findSensorByNameInScene(sensorName )
  objectNames = getOwnersNames(sensors )
  print ("Objects with sensor '{}': {}".format(sensorName,objectNames ) )

#--- internal functions
def getOwnersNames(logicBricks):
  return [logicBrick.owner.name for logicBrick in logicBricks]

def findSensorByNameInScene(sensorName):
  scene = bge.logic.getCurrentScene()
  allObjects = scene.objects
  return findSensorsByNameIn(allObjects , sensorName)

def findSensorsByNameIn(objects, sensorName):
  sensors = []
  for gameObject in objects:
    sensorsOfObject= findSensorByNameInObject(gameObject, sensorName)
  return sensors

def findSensorByNameInObject(gameObject, sensorName):
  for sensor in gameObject.sensors:
    if sensor.name == sensorName:
      return [sensor]
  return []

I think he means inside the Editor. But the principle still stands from Monster’s post. Using bpy, and the object.game which has “properties”, “controllers”, “sensors”, “actuators”