transferring properties between scenes?

im pretty sure that i can do this by saving the property to the global dict, and then loading it after i get to the new scene, but how can i do this? thanks

as you said - use the global dictionary. scene changes will not delete its content.

in python:

bge.logic.globalDict[‘mydata’]=…

your original code didn’t work (“bge is not defined”) but i fixed it, here are the final two codes(one is load and one is save)

save script:

cont = GameLogic.getCurrentController()
own = cont.owner
GameLogic.globalDict['mydata'] = own['prop']

Load script:
cont = GameLogic.getCurrentController()
own = cont.owner
own[‘prop’] = GameLogic.globalDict[‘mydata’]

hope this helps anyone that needed help with the subject

bge.logic is the new 2.54 syntax. As far as I know GameLogic (and Rasterizer) will still be available.

@Monster If you mean that in the 2.54 version, GameLogic is available, it isn’t now; maybe when it’s finished.

Interesting. I just tried and it is there.

If it would be removed it still could be defined as:


import bge.logic as GameLogic
...

which makes a lot of 2.49 scripts compatible with 2.54 (not all I know)

How did you manage to make the “bge is not defined” work? I have tried everything from all forums but it still brings up the same error

import bge