Get Body of Last Recieved Message :: BGE Python

Hello, all, I am trying to develop a simple inventory system for the game engine and I cant figure out how to get teh body of the last recieved message. Here is a basic description of what I want to do.

mess = messageSensor
prop = mess.lastrecievedbody

if prop = “so and so”:
doSomeStuff

elif prop = “so and not so”:
doSomeOtherStuff

Please reply soon. I will post a .blend with my system when it is complete.

I think you can do it using (using your terminology)

prop = mess.bodies[-1] 

Because mess.bodies will return a list of the last received message bodies. Calling the -1’st will call the last entry in that list.

Best of luck!

Thanks, Red Hand!

EDIT: It almost worked. I got an error saying PythonListIndex out of range in CValueList. Any ideas?

EDIT 2: I got it! It was [-1]. I switched to module and hit that little D next to the controller.