send properties value to multiple scenes

Agoose i tried to modify your script so i could access multiple properties from many different scenes.And it did not work.Here is the script.

import bge
def set():
 cont = bge.logic.getCurrentController()
 own = cont.owner
 #Change this to the name of the property
 property_name = 'going'
    property_name = 'stop'
 bge.logic.globalDict['going'] = own[property_name]
    bge.logic.globalDict['stop'] = own[property_name]
def get():
 cont = bge.logic.getCurrentController()
 own = cont.owner
 #Change this to the name of the property
 property_name = 'going'
 property_name = 'stop'
    own[property_name] = bge.logic.globalDict['going']
     own[property_name] = bge.logic.globalDict['stop']


May I ask why you define the property/key names multiple times? This easily leads to typing errors.

When you use variables you better create a variable for each purpose. In your code you override the first property name with the second.

Be aware you do not need to use the property name as key name.

I suggest such a code:


KEY_GOING = "going"
KEY_STOP = "stop"

storage = bge.logic.globalDict

def store(controller):
    source = controller.owner
    storage[KEY_GOING] = source[PROPERTY_GOING]
    storage[KEY_STOP] = source[PROPERTY_STOP]

def restore(controller):
    target = controller.owner
    target[PROPERTY_GOING] = storage[KEY_GOING]
    target[PROPERTY_STOP] = storage[KEY_STOP]

Besides the fact that you’ve made some errors in the code posted, try this

But monster’s code seems better.I could add as many properties as i like with it.But really all i am going to need is two.up and down property
for north and south and left and right property for west and east.It may solve someoneelses problem as well.Someoneelse asked the same question
i think.This is for a maze game that would seem to have more space than it does.This is explaination of how it does this.You start off on start
scene when you go through north exit you go to the south scene.And on the south scene you are near the south exit and have you go to the north
exit.If you go through the north exit on the south scene you go to the start scene.You have go through north exit twenty times to go to the the
city scene.It uses the up and down property to accomplish this.A invisible rectangle in the north exit of both those scenes has a collision
sensor dectect the property player and then sends a signal to the and controller which sends a signal to the add property actuator that sends a
value of one to the up and down property before it switches scenes.And the invisible rectangles also have on them a property sensors set to
interval with property name on it of up and down and for minmum20 and a maximum of 25.Which is connected to a and controller.Which is connected
to a set sene actuator.With either south sene on it or start scene on it.

If you check out the file that I’ve linked, it’s easy to add new properties. The script uses the connected property actuators to work out which properties you want to copy.

I thought monster’s script was adequate for what wanted to do evidently not.Because if i go back to a previous scene the properties will return to previous values.So i will try and use yours.