Can I contorl the object's action in overlay scene ?

I added an overlay scene, there is a object has animation keyframes.
There are some objects with different property in current scene,
I want to mouse click one of objects in current scene,
the object in overlay scene will play animation with specify property/keyframes.

I tryed direct action, but it not work.
I try send message from current scene to overlay scene,
but I don’t know how to receive the property from message.

I’m new, Can I do that only use logic not python script?

message sensor--------python


import bge
cont = bge.logic.getCurrentController()
own=cont.owner
message=cont.sensors['message']

if message.positive:
    own['property']=message.bodies[0]


this will set the property in the reciever as whatever the body of the message was.

sending messages using python

http://www.blender.org/api/blender_python_api_2_65_release/bge.logic.html#bge.logic.sendMessage


bge.logic.sendMessage(subject, body="", to="", message_from="")

BGE Guide to Messages incl. Healthbar tutorial

Thank you very much, BluePrintRandom & Monster.
I can run Monster’s S2A.py succeed,
but I can’t run BluePrintRandom’s script.

Here is my test file, click cube, sphere move.
Please tell me what am I doing wrong?
message_test.blend (607 KB)


Hi YQ-YSY,
my_object[‘variable_name’] refenences a specific property of the corresponding object.
In order to make the scrip work, you need to insert the exact names of the properties (regard upper- or lowercase letters).
The line

message=cont.sensors['message']

tries to reference a sensor called “message” but yours is called “Message”.

The line

own['property']=message.bodies[0]

tries to reference a property on the sphere called “property” but yours is called “prop”.

You can also access variables across scenes using logic.globalDict (which is an array in the logic dedicated to storing your own variables).

Thank you Wendigo & MrPutuLips. Finally I solved BluePrintRandom’s script.
I correct the name of of the properties “messages” and “property”,
but then I received the message is “-1” , not the right value,
I search google found this arcticle, solved this problem:
http://blenderartists.org/forum/archive/index.php/t-243697.html
In BluePrintRandom’s script, just add int() in front of message.bodies[0] is OK.

import bge
cont = bge.logic.getCurrentController()
own=cont.owner
message=cont.sensors['message']

if message.positive:
    own['property']=int(message.bodies[0])

Thanks all again.