Module GameTypes :: Class SCA_PythonController
[hide private]
[frames] | no frames]

Class SCA_PythonController

source code

PyObjectPlus --+            
               |            
          CValue --+        
                   |        
     SCA_ILogicBrick --+    
                       |    
         SCA_IController --+
                           |
                          SCA_PythonController

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

Properties:

Instance Methods [hide private]
 
activate(actuator)
Activates an actuator attached to this controller.
source code
 
deactivate(actuator)
Deactivates an actuator attached to this controller.
source code
    Deprecated
string
getScript()
Gets the Python script body this controller executes.
source code
 
setScript(script_body)
Sets the Python script string this controller executes.
source code
    Inherited from SCA_IController
SCA_IActuator
getActuator(name)
Gets the named linked actuator.
source code
list [SCA_IActuator]
getActuators()
Gets a list of all actuators linked to this controller.
source code
SCA_ISensor
getSensor(name)
Gets the named linked sensor.
source code
list [SCA_ISensor]
getSensors()
Gets a list of all sensors attached to this controller.
source code
int
getState()
Get the controllers state bitmask, this can be used with the GameObject's state to test if the the controller is active.
source code
    Inherited from SCA_ILogicBrick
integer
getExecutePriority()
Gets the execution priority of this logic brick.
source code
KX_GameObject
getOwner()
Gets the game object associated with this logic brick.
source code
 
setExecutePriority(priority)
Sets the priority of this logic brick.
source code
    Inherited from CValue
string
getName()
Returns the name of the CValue.
source code
    Inherited from PyObjectPlus
bool
isA(game_type)
Check if this is a type or a subtype game_type.
source code
Instance Variables [hide private]
int mode
the execution mode for this controller (read-only).
string script
The value of this variable depends on the execution methid.
    Inherited from SCA_IController
sequence supporting index/string lookups and iteration. actuators
a list of actuators linked to this controller.
sequence supporting index/string lookups and iteration. sensors
a list of sensors linked to this controller
int bitmask state
the controllers state bitmask.
bool useHighPriority
When set the controller executes always before all other controllers that dont have this set.
    Inherited from SCA_ILogicBrick
int executePriority
This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
string name
The name of this CValue derived object (read-only).
KX_GameObject or None in exceptional cases. owner
The game object this logic brick is attached to (read-only).
    Inherited from PyObjectPlus
bool invalid
Test if the object has been freed by the game engine and is no longer valid.
Method Details [hide private]

activate(actuator)

source code 
Activates an actuator attached to this controller.

deactivate(actuator)

source code 
Deactivates an actuator attached to this controller.

getScript()

source code 
Gets the Python script body this controller executes.
Returns: string

Deprecated: Use the script attribute instead.

setScript(script_body)

source code 
Sets the Python script string this controller executes.

Deprecated: Use the script attribute instead.


Instance Variable Details [hide private]

mode

the execution mode for this controller (read-only).
  • Script: 0, Execite the script as a python code.
  • Module: 1, Execite the script as a module and function.
Type:
int

script

The value of this variable depends on the execution methid.
  • When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts.
  • When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts. note: once this is set the script name given for warnings will remain unchanged.
Type:
string