Message Sensor: subjects

subjects
  • Returns a list of the message subjects received

Type:
  • String List
  • Takes the form: ["message subject 1", "message subject 2", etc]
Message Sensor:
  • Receives messages from a Message Actuator.
  • When the Message Sensor receives a message, one positive pulse is sent to the controller, immediately followed with one negative pulse.
Sample Code


################  Get a list of the message subjects
 
# import bge module

import bge

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

# get the sensor attached to the controller
# my sensor is named Health

sen = cont.sensors["Health"]

# get a list of message subjects
list = sen.subjects