how to "getDiffrentScene" ?

if logic.getCurrentScene()
how do i get a different scene ?

i want to make a hud

Have you looked at ‘bge.logic.getSceneList()’? Seems like you can call that then iterate the list to find the correctly named scene.

sorry i will explain more of what i am trying to do
i want to display the loc of an obj that has been spawned in in real time

this is what i have so far\and it runs once every every 2s

def Playerloc():
Ppos = logic.getCurrentScene().object[‘Player’].position
logic.getCurrentScene().objects[“Textloc”][‘Text’] = str(Ppos)

i have moved the text on to the same scene just to get it to work with out worrying about the scene stuff for now

but i get this error when ever it runs

Python script error - object ‘Empty’, controller ‘Python’:
Traceback (most recent call last):
File “C:\Users\New\Desktop\BD0.5.blend\Text.py”, line 77, in Playerloc
Tbc = 0
AttributeError: ‘KX_Scene’ object has no attribute ‘object’

line 77 is
Ppos = logic.getCurrentScene().object[‘Player’].position

The list of objects in the KX_Scene object is ‘objects’ not ‘object’, you are missing an ‘s’.


Ppos = logic.getCurrentScene().objects['Player'].position

YES THANKS THAT HAS BEEN DRIVING ME MAD FOR HOURS :smiley: :smiley: :smiley: :smiley:

ok now i know what scene i want but i dont know what to type in to get it

ok found it on an older post :smiley:
i have no clue how it works bit it does lol

import bge

scenes = bge.logic.getSceneList()

my_scene = [scene for scene in scenes if scene.name==“My Scene”][0]
object = my_scene.objects[‘My Object’]