Save and load gobalDic and python

Hi can anyone help me here with this script, I want the upbge to store the both of the functions, but it store one of them only, if I run the second level, it will clear the first one and write over it.
pleas help. :slight_smile:

import bge

def stars(cont):# for cube in scene 1
own = cont.owner
bge.logic.globalDict[‘temp’] = own [‘count’]
bge.logic.saveGlobalDict()

def get_stars(cont):
own = cont.owner
bge.logic.loadGlobalDict()
own[‘star’] = bge.logic.globalDict[‘temp’]
del bge.logic.globalDict[‘temp’]

def levels(cont): # for another cube in second scene
own = cont.owner
bge.logic.globalDict[‘0’] = own [‘car_level’]
bge.logic.saveGlobalDict()

def get_levels(cont):
own = cont.owner
bge.logic.loadGlobalDict()
own[‘race’] = bge.logic.globalDict[‘0’]
del bge.logic.globalDict[‘0’]

try the game engine subforum. Also- use the code tags when posting code.

1 Like