send properties value to other scene


I have an overlay scene for my speedometer. Now I need the values from the main scene to be transmitted to the overlay scene. I read that this is done with messages. Also I read that messages can only send strings. Since the speedometer is working with integers, how can this be solved?

I couldn’t figure out how to do this. Can someone help? Is there an example blend out there?

Thanks for any help!

I think you can (in the properties panel) set it to copy? I amn’t sure though, Sorry.

You have many options here, let me find an old post of mine.

Easiest to use bge.logic.globalDict in a python script. Copy this script into a new file in the text window. Call this “” without the quotes.
On the object to send the property:

  • Create an always sensor, and set it to True Pulse Enabled (the first …).
  • Connect the always to a Python Module Controller (Python ->Module) and type ‘properties.set’(without quotes)

On the object to receive the property:

  • Create an always sensor, and set it to True Pulse Enabled (the first …).
  • Connect the always to a Python Module Controller (Python ->Module) and type ‘properties.get’ (without quotes)

In the script, change the value of ‘property_name’ to the name of the property to get or set. They can be different, as long as the property_name in get gets the property of that object, and the property_name of set is the same as the property you want to set it to.

import bge

def set():
	cont = bge.logic.getCurrentController()
	own = cont.owner

	#Change this to the name of the property
	property_name = 'property_1'

	bge.logic.globalDict['property'] = own[property_name]

def get():
	cont = bge.logic.getCurrentController()
	own = cont.owner

	#Change this to the name of the property
	property_name = 'property_1'
	own[property_name] = bge.logic.globalDict['property']
1 Like

Thanks a lot!!! it works :slight_smile:


But now another problem has come… Example: I’ve got an indicator for the height, one for the speed and another one for another speed. All the properties are named “Text” so it can be displayed on screen. Now with the script it can only be displayed one property named Text… I made a properties1, properties2 and… that doesn’t help.
Then I named the Property named “Text” to Text2 and Text3 but like that the Integer is not displayed anymore with the font…

Do you know how I can solve this issue?

Thanks in advance for help!

modify the script and add a property named id.
add a propert called id and have the same id on object that use that text, have it add it do the name of the variable. and remove it when finding what property to change.

Or simply send the property value via message actuator
Use S2A.firstBodyToValue from S2A to feed a property actuator at the display object.

hmm, it’s hard to understand… what I did so far:

i have an empty1 in Scene1 with a property named velocity, as well as I have a empty2 with a property named altitude in Scene1.
In scene2 (overlay-scene) I have two planes to display the scene1 properties altitude and velocity. To be able to display the font both planes have the same property named “Text”. (The only way to display the property’s value with the font is by naming the property “Text”, isn’t it?!)

With the it works well for 1 plane, but as soon as I try to assign a second to the second plane, both planes display the same value (either the altitude or the velocity).

Ok, so I tried it with the S2A.firstBodyToValue…

What I did(an example with the altitude empty)

altitude_empty(Property:altitude - Integer):
Always Sensor - AND - Message Actuator (To: Receiver, Subject: newaltitude, Body: Prop: altitude)

altitude.plane(Property: Text - Integer):
Message Sensor (Subject: newaltitude) - Python Module: S2A.firstBodyToValue - Property Actuator (Assign: Text)

That’s it, but then I get a lot of error messages in the console. E.g.: ‘module’ object has no attribute ‘StringType’ (in line 93) etc

Do I have to delete all the code in the script that is not needed?

I can’t get it to work for me… can you check it?

object that sets

and object that should get with code… I don’t know if write it good

yeeehaaaa! thanks a lot! It’s working :slight_smile:

Can you share Your knowledge like they did for You ? :slight_smile:

Thanks, I understand more now but… There’s script text missing in your example…
that example from @agoose77 m should be good for me but… I don’t know what I’m missing. You’r example is different and use message sensor…
Or can I just ask for a little .blend file to see what is all about?

Just download the S2A.blend.

You can find it in the top post of the thread with the tutorial.
The that you need is in there.
You can append it into your file with <shift F1>. It is a text.

I have trouble to get something to work…

I’m using script to turn around using right mouse button
Now I try to make action after mouse over of one item from HUD
sharing properties from other scenes works for me using S2A but… I can’t get it to work with my thing…

I was trying to put state 3 of camera on main scene after mouse over on item from hud. Script with turn around using rmb shouldn’t work on state 3, to visualize that I’ve set motion in the same time.

But it would be seen anyway, because cursor wouldn’t be set on the center of the screen after click.

On mouse not over properties should get to other value, and that should set camera state on main scene back to 2 and script with rotating thing should work again.

But it seems nothing works like it should… Can someone look at my file and try to help?

Link to the .blend file

The main reason is that it switches to state 3 on mouseover, but then doesn’t have the message sensor -> S2A so it cannot receive the “not over button” message

Why do I need sensor to read property on state? I think property is shared between states and even without msg sensor property sensor will get new value.
But I’ve tried to add same message sensor on state 3 and didn’t work… I can’t figure out what can I do more… maybe it’s colliding with rotation script somehow?

it does work, i did it.
First, the message on the button is sending to the cube, it should be sending to the camera.
Next, state 3 is activated when the button is moused over.
This means your property is set to one.
On state 3 it will only go back to state 2 when the property is 0. Which it can never be, because it doesn’t have the message sensor setting it to 0.
Add the message setup (always ->python ->property…) to state 3, and change that value as i said at the start, and it works.

great it works! yeah the main problem was that I set wrong target of message! I appreciate your time and willing to help me. Thank You very much ! :slight_smile:

Yes, indeed, but in this case, that was the underlying issue.

thx for help one more time