Attribute error

Hello Everyone,

I am having issue when running one BGE project downloaded from web.
Game doesn’t start properly and console spits the following error:

AttributeError: “KX_Scene” object has no attribute ‘getObjectList’

here is the part of the python code which produces that:

import GameLogic as g
objlist = g.getCurrentScene().getObjectList()
# -------------------------------------
cont = GameLogic.getCurrentController()
own = cont.getOwner()

obj = objlist['OBSphere']

What could be the reason of such behavior, am I doing something wrong?

Thank you!

AttributeError means there is a problem accessing the attribute you’re looking for
In this case, it’s trivial - getObjectList() is deprecated.
the new code is

import bge

cont = bge.logic.getCurrentController()
own = cont.owner
scene = bge.logic.getCurrentScene()
objects = scene.objects

Cheers mate!

I should have noticed that game file is dated by 2009, obviously blender was further developed since that time.

However after downgrading my blender to version 2.49 I faced with another error message:

Fragment shader failed to compile with the following errors:
ERROR: 0:103: error(#160) Cannot convert from ‘float’ to ‘3-component vector of float’

Sounds like a video card issue? Any clues?

Thank you!

No, the Vector Thing has changed. I cant explain you how to solve it, but a look in the API should help!
You might import mathutils, wich give you the Vector back.

Could you post a script or blend? I think i could fix that.

I would be so much thankful if you could do this!

I am new to both python and blender what makes it quite difficult to debug any issues

Here is the blend file clouds_new_1.blend (305 KB)

Thank you.

Sorry, but there were way too many errors!
I tried to fix them, but the shaders are still not working. I dont know OpenGL — sorry

I recommend to use a MouseLook for 2.5+, then step by step implement the shaders----

Not all at once—

Anyway, here is the (almost) fixed blend:

I’m not shure, but i think shaders can not simply be atttached as a script, they should be in an Actuator( Filter2D )-> Custom Filter.

And: for wich blender do you want to use it ? 2.4 or 2.5 or 2.6x?


clouds_new_1.blend (454 KB)