Message sensor

The message sensor is waiting to receive a message sent by a message actuator. This sensor is typically used to communicate between objects when using the logic bricks.
When a message is received, a positive pulse is sent to the connected controller(s) followed by a negative pulse.

Option(s) of the Message sensor :

Python :

# import bge module
import bge
# get the controller
cont = bge.logic.getCurrentController()
# get the sensor attached to the controller
# my sensor is named Trigger
sen = cont.sensors["Trigger"]
  • sen.bodies : Returns a list of the message bodies received by the message sensor.
  • sen.frameMessageCount : Returns the number of messages received since the last frame.
  • sen.subject : gets/sets the message subject the sensor is listening for (a string).
  • sen.subjects : Returns a list of the message subjects received.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License