Can Messages be sent to a Wild card?

Hi there… can a Message Actuator send a message to a wildcard?
For example: Boy_*
So that anything with Boy_ at the beginning of it’s name, gets the message.

It would be possible… with python.

So you can’t just type in Boy_* in the “To” part of the message actuator?

Yes because the “To” part only accept complete object name.

By the way, the code would look like this:


You can set a subject in the message sensor and the message actuator.

for example:
The message actuator use a subject called ‘Boy’
And every object with ‘Boy_’ in their name have a message sensor with ‘Boy’ as subject.
If you do this, all the other message sensors will need a subject.

By the way the code would look like that:

import bge

objects = bge.logic.getCurrentScene().objects

for object in objects:
    if 'Boy_' in
        bge.logic.sendMessage('Message Subject', 'Message Body',, 'From')

Cool… thank you.
Would be easier if it just let you put in a damn asterix.

or use:

import bge

objects = bge.logic.getCurrentScene().objects

name = 'Boy_'

[bge.logic.sendMessage('Message Subject', 'Message Body',, 'From') for o in objects if]

Messages are filtered by subject.

Sending messages with a “To” field creates a very strong dependency on the object name. You should avoid that.