Animation Script Issue

Hey guys i made this script a while back for making my very own animated textures for python 2.6/Blender 2.49.

I just recently upgraded to Python 3.22/Blender 2.6, so importing my animation script was a little bit difficult. When i run this script the interpreter keeps telling me that getMesh is deprecated, so i converted it to meshes. Even when i changed it to meshes it caused more problems. Can anyone help me figure this thing out?

from bge import logic as gl

cont = gl.getCurrentController()
own = cont.owner

mesh = own.meshes

for mats in range(mesh.getNumMaterials()):
for vtx in range(mesh.getVertexArrayLength(mats)):
vertex = mesh.getVertex(mats,vtx)
uv = vertex.getUV()

    uv[1]+=obj.y/500.0
        
    vertex.setUV(uv)

There is a new API for 2.6 and the old 2.49 API is not supported any longer.

You will have to re-write your script using the new API.

Thank you for the site! It really helped. i Did my research and I rewrote the script.

Here is the script to move UV in real-time(11 Lines):

from bge import logic as g

own = g.getCurrentController().owner
mesh = own.meshes

for meshes in range(len(own.meshes)):
for vtx in range(mesh[meshes].getVertexArrayLength(0)):
vertex = mesh[0].getVertex(0,vtx)
uv = vertex.getUV()
uv[1]+= own[‘Speed’]/500.0
vertex.setUV(uv)

simple version (4 Lines)

from bge import logic as g
m=g.getCurrentController().owner.meshes
for a in range(m[0].getVertexArrayLength(0)):
v=m[0].getVertex(0,a);u=v.getUV();u[1]+=0.003;v.setUV(u)