copy properties through different files / levels

how do i copy a property from one game (one .blend, or .exe file) to another files?

I got a level (1) and i got the property “key” which tells me how much keys i have found (example: 5) in my game. Now i want to level (2) and of course the property is now set to 0 again…how do i link these levels, so that the second levels copies the property “key” from level in?

thanks for the help…

use a python script to save the properties to a global variable


g = GameLogic
cont = g.getCurrentController() #Get The Controller That Uses The Script
own = cont.getOwner() #Get the object that the controller is on

g.Property = own.Property
#g.Property is the name of the global property you can namne it to anything
#as long as the 'g.' is in front of it
#own.Property is the name of the property in the object you want to make
#global change 'Property' to the name of the property
#copy and paste "g.Property = own.Property" as many times as needed

well thanks for the script, but how do i use it?

whats a global variable? and how do i save it? i got a normal save-script for the position and properties of objects, too. Do i have to use it here?

you just put that script on your object that you need properties from. When you need to use them, you don’t call the property of the object but you call g.property (whatever you named it)

All its doing is setting a property to be global , meaning blender understands it through out the whole game. obj.properties are local to only the object.

but i need to save the property with a save-script to a .glx file or something like this, right?

I still dont know what global means…a scene in a .blend file or all scene in a .blend file or all .blend files in my folder?

Do you have an example file? Could you please upload it?

well, first of all there are no files

when you call a script in game blender it usaly is only for the object that you attached the script to.

also the script only works for when its running. no files ect…

so I might make a example later for now.

you have object with script and you get its properties.
then you have another object with anthor script and you get the properties of the other object.

you have to use a global property, this means that this property is not of any object , it is of the scene. When using these scripts and commands as listed above, they all all 0 when you start or dont exist. you make them then pass them then call them. Then when the game stops it all goes back to 0 or non existant.