Module SCA_PythonController :: Class SCA_PythonController

Class SCA_PythonController

SCA_ILogicBrick.SCA_ILogicBrick --+    
                                  |    
    SCA_IController.SCA_IController --+
                                      |
                                     SCA_PythonController

A Python controller uses a Python script to activate it's actuators, based on it's sensors.

Properties:

Instance Methods
 
activate(actuator)
Activates an actuator attached to this controller.
 
deactivate(actuator)
Deactivates an actuator attached to this controller.
list [SCA_ISensor]
getSensors()
Gets a list of all sensors attached to this controller.
SCA_ISensor
getSensor(name)
Gets the named linked sensor.
list [SCA_IActuator]
getActuators()
Gets a list of all actuators linked to this controller.
SCA_IActuator
getActuator(name)
Gets the named linked actuator.
string
getScript()
DEPRECATED: use the script property Gets the Python script this controller executes.
 
setScript(script)
Sets the Python script this controller executes.
int
getState()
DEPRECATED: use the state property Get the controllers state bitmask, this can be used with the GameObject's state to test if the the controller is active.
integer
getExecutePriority()
Gets the execution priority of this logic brick. (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
KX_GameObject
getOwner()
Gets the game object associated with this logic brick. (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
 
setExecutePriority(priority)
Sets the priority of this logic brick. (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
Instance Variables
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first). (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read only). (Inherited from SCA_ILogicBrick.SCA_ILogicBrick)
string, read-only script
the Python script this controller executes
integer state
the controllers state bitmask.
Method Details

activate(actuator)

 

Activates an actuator attached to this controller.

Parameters:
  • actuator (actuator or the actuator name as a string)

deactivate(actuator)

 

Deactivates an actuator attached to this controller.

Parameters:
  • actuator (actuator or the actuator name as a string)

getSensor(name)

 

Gets the named linked sensor.

Parameters:
  • name (string)
Returns: SCA_ISensor

getActuator(name)

 

Gets the named linked actuator.

Parameters:
  • name (string)
Returns: SCA_IActuator

setScript(script)

 

Sets the Python script this controller executes.

Parameters:
  • script (string.)

getState()

 

DEPRECATED: use the state property Get the controllers state bitmask, this can be used with the GameObject's state to test if the the controller is active. This for instance will always be true however you could compare with a previous state to see when the state was activated. GameLogic.getCurrentController().getState() & GameLogic.getCurrentController().getOwner().getState()

Returns: int

Instance Variable Details

state

the controllers state bitmask. This can be used with the GameObject's state to test if the controller is active.
Type:
integer