Message Actuator Property: subject

subject
  • gets/sets the subject field of the message. 
     
  • Used by Message Sensors to filter messages.

Type: 
  • string
Note:
  • Sends a message to a Message Sensor(s).
     
  • The message sent will be the value of the selected Property. 
Sample Code


################  Get the subject used to filter messages.

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Add_Health

act = cont.actuators["Add_Health"]

# get the subject filter
filter = act.subject
 
Sample Code


################  Set the subject used to filter messages.

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Add_Health

act = cont.actuators["Add_Health"]

# set the subject used to filter messages
act.subject = "Health"