And I’m talking only well written proposals including code mockups and a reason for it to be a new BGE API feature, don’t use a one liner and be done with it, here’s an example.
PROPOSAL: RECIEVE MESSAGES IN A SCRIPT SO THERE’S NO NEED FOR A MESSAGE SENSOR:
We all know the sendMessage function
sendMessage(subject, body, to)
We can send messages, but objects need bricks to check for them, in other words, a function would be nice and handy.
Why would this function be useful, in very complex games there may be a lot of messages being sent and recieved throughout the game, this proposed function would eliminate the need for message bricks, and therefore reduce logic brick mess.
Ways to do this could be this. NOTE: Slot argument would not be needed if the 4th possibility for a python function to recieve the message uses a string where you type in the name itself.
obj.sendMessage(subject, body, to, slot)
See the slot argument, this would be neccesary incase a recieving object gets more than one message at the same time, you could leave this empty, but then a recieving object will only get one message per frame.
Ways to recieve it are as follows
It could be part of an if statement that checks if the object is receiving the message and returns true if it is
if obj.recieveMessage(slot) == True:
Perhaps a property would be better (value equals slot number of message recieved that frame)? Drawback is that there’s no facilitation for more than one message per frame.
if obj.messages == 1:
Or you can do it like the meshes property (no. in brackets equal slot number of message)
if obj.messages[5] == True:
Or you may not need a slot argument for the sendMessage() function at all, just make the recieve command use a string that is the name of the message (I really like this last option as it doesn’t change the sendMessage() function and its arguments at all (remember that the message name has to be typed exactly and is case-sensitive))
if obj.recieveMessage("elevator") == True:
For all these possible recieve functions do note the string version will not work if you send the message with an object name in the TO field that’s not the recieving object even if the message title is the same.
List your proposals for the API here, remember they must be detailed and include code mockups.