Message Sensor: frameMessageCount

frameMessageCount
  • Returns the number of messages received since the last frame.

Type: 
  • integer
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 the number of messages since last frame
 
# 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 number of messages since last frame
mess_number = sen.frameMessageCount