Message Sensor: bodies

bodies
  • Returns a list of the message bodies received by the message sensor

Type: 
  • List containing Text and/or Property Name
  • Takes the form: ["message1", "message2", 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 bodies
 
# 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 bodies
list = sen.bodies