A simple question about python

Hi all,

I’m programming a little python script and would like to know how I can get the name of the owner.

I searched in the GameLogic Class Reference but I didn’t find any answer :(.

Why do you need the name of owner? If it contains usefull information, store this information in property of this object and then you can access it.

Owner of what?

if you want the game object owner of the controller (or actuator or sensor) try:

cont.GetOwner()
(I foret if the G is capital)
where cont is the controller

ashsid : I want to create a view like Resident Evil : When the player touch an invisible object, a camera will be set. Exemple : if the player touch the object touch.001 the camera camera.001 will be set. I want to use the name of the object, because when we duplicate object, the new object name will change automatically. I hope that you’ll understand what I mean, because I have more difficulty to explain myself in english (I’m a french)

z3r0 d : cont.getOwner() don’t return the name of the owner in string. I want to have the name in string.

cont.getOwner().getName()[2:]
is what you are looking for:) The [2:] is to cut off the “OB” that is at the begining of all object names. getName() is undocumented I believe, and doesn’t show up in dir()'s, so it’s kind of annoying >:<

But getName() works for both objects and meshes.

saluk : thank you very much :smiley:

Darn, you beat me to the draw saluk :stuck_out_tongue:

Good luck with your game eddie :slight_smile: