BPYAPI 3.1 help?

Hi everyone, i have a few questions about the latest GE pyapi.
firstly, what is the alternative to “GameLogic.”, as in the variables you assign to GameLogic, such as GameLogic.coolthing as apposed to GameLogic.getCurrentController()

owner.worldOrientation = getattr(GameLogic,owner.named)[1]

could you port that?

Import bge (import bge) and use bge.logic instead of GameLogic.

I know, but i can’t use setattr!
i tried this:

owner.worldPosition = bge.logic[owner.named][0]

this is what it is in 2.49b

owner.worldPosition = getattr(GameLogic,owner.named)[0]

Do you mean global variables?
If so, you must use

if not hasattr(bge,"your_variable"):

note: the attribute is given to the bge module, not bge.logic(GameLogic) as in 2.49

That’s why! thanks!
can i use that method if i am assigning a variable:

var = bge.owner["named"][0]


var = bge.(owner["named"][0])


var = bge.str(owner["named"][0])

or would i have to use

named = owner["named"][0]
var = bge.named

note the reason i am using a variable is that it uses the value of a property of the owner as a known created variable;
for showing & deleting enemies on map.

Global vars shouldn’t be stored on the bge or GameLogic modules as attributes as I believe those modules are reinstated on game changes, instead you should use the globalDict atrribute (which is a dictionary object) of bge.logic and GameLogic, e.g:

bge.logic.globalDict['var'] = 1
GameLogic.globalDict['var'] = 1

would i be right in thinking this would remain as a value, even after using the set scene actuator?
But the main question i have is how to name a globalDict variable with a variable, read the comments:

import bge
controller = bge.logic.getCurrentController()

#nameofowner gets the name of the owner object, uses that as a variable,
#e.g if the <b><i>owner was called 'boat'</i></b>, in 2.49b it would be: <b><i>GameLogic.globalDict['boat']</i></b>
#but i want <b><i>to set and get it using</i></b> a<b><i> python</i></b> variable: '<b><i>controller.owner</i></b>';
#should i use '<b><i>bge.logic.globalDict[str(controller.owner)]</i></b>' or '<b><i>bge.logic.globalDict[controller.owner]</i></b>' ??
nameofowner = controller.owner
attribute = bge.logic.globalDict[nameofowner]

You can get the name of an object via the name attribute:

nameofowner = controller.owner.name

i know, but can i get the GlobalDict to read it as a string, not a python variable if i don’t use quote marks?

import bge
controller = bge.logic.getCurrentController()
nameofowner = controller.owner.name
attribute = bge.logic.globalDict[nameofowner]
#without ('') marks, will it be read as a string value of the python script?