How to set up an object with multiple message bodies?

I have set up an object with multiple message bodies in the order of 0, 1, 2, 3, 4, 5. Each body is tied to a property that is sent. A script on the receiver Empty object checks the subject and assigns the property to the body with the property. For example, if the property “health” is in body number 0, then the property in the receiver Empty will be assigned to the body that is 0, and a Property actuator is then activated and assigns the property.

Problem is that when I use len(sensor.bodies) to check the bodies, it won’t execute because it’s looking for a body number of exactly 0, 1, 2, 3, 4, 5 to evaluate, and since it’s never evaluated, the snippet of code I write that is meant to be assigned to a HUD is never executed. How do I split, or make the len() function work so the message bodies are assigned onto whatever objects I program them to be assigned to?

With a single body (sensor.bodies[0]), it is easy enough, but with multiple bodies, it is exponentially harder. I know len() gets the length of something, while range() checks whatever is in a certain value area, like 0 - 5 for example.

A good example is if you want to set up a “HUD manager” type object, which would be an Empty that would deal with processing different aspects of the HUD, like health, score, you name it, but this involves multiple message bodies being sent to the object. You would need to somehow tell the script to check for a particular message or check the bodies using len() or range() and assign whatever body to the correct object based on the property. A health property goes to a health object, while score would go to a Text object for example.