Teleporting Character (Python trouble)

EDIT: Problem has been resolved thanks to Sim88.

Sim88 said:

Object names start with OB, so if the object is called Portal it should be [“OBPortal”]

in blender 2.49 an later use:

cont = GameLogic.getCurrentController()
own = cont.owner
portal2 = GameLogic.getCurrentScene().objects["OB+portal's name goes here"]
own.position = portal2.position

-----------------------------[/edit]
This one is simple. So simple that it has dumbfounded me. I have Google searched all over the place for this subject and couldn’t find anything that works with Blender 2.49 and/or Python 2.6. I need for my “player” object to get the position of “portal2” and then set it’s own position to that one recorded for portal2; all when it collides with portal1. I’m thinking something along the rough and obviously not correct lines of:

cont = GameLogic.getCurrentController()
own = cont.getOwner()

p1 = object.getPosition("portal1")

owner.setPosition("p1")

My idea for this is a lot similar to the Portal game by Valve. I want to be able to place a portal anywhere while playing in the Game Engine, rather than setting it up prior to playing the game. I attached the .blend file so you know what I’m talking about.

Attachments

portal teleport.blend (168 KB)

maybe try

own = cont.owner

that’s for starters I guess

I’m just learning Python myself so this might not work try

cont = GameLogic.getCurrentController()
own = cont.getOwner()
portal2 = getCurrentScene().getObjectList()[Portal2’s name goes here]
portal2.getPosition
own.setPosition(portal2)

Not entirely correct. This uses the API prior to 2.49, it should look like

cont = GameLogic.getCurrentController()
own = cont.getOwner()
portal2 = getCurrentScene().getObjectList()["OB+Portal2's name goes here"]
portal2pos = portal2.getPosition()
own.setPosition(portal2pos)

Object names start with OB, so if the object is called Portal it should be [“OBPortal”]

in blender 2.49 an later use:

cont = GameLogic.getCurrentController()
own = cont.owner
portal2 = GameLogic.getCurrentScene().objects["OB+portal's name goes here"]
own.position = portal2.position

Thanks everyone! I really appreciate all the help. The 2.49 and later code really helped, Sim88.