Saving strings as Global

Has anyone else tried to save a string as a Global variable? What is the procedure (if there is one)?


import GameLogic as G
G.globalstring = "yaythisisastring"

G.globalstring is the global variable
i think thats what you are asking

Yeah, that’s what I thought. It’s not working. When I try to get the string it gives me the name of the object it is in.
What I am trying to do is take the user’s name and apply it elsewhere in the application. I’ll have to keep debugging it I guess. Thanks anyways.

youre doing something wrong post your .blend

You don’t need to post a .blend. The problem is rather obvious based off of your description of the results. You are using a reserved property. The property named “name” is reserved for the object name. You cannot have a property named “name” anywhere in a BGE script. It will only return object names. Change the variable name to “uName” or “userName” or something else.

Ok, that was a forehead slapper. Thanks Blendenzo.