I’m currently writing a simple script to allow bots to follow a path of nodes (it’s pretty much a Python version of Mmph’s early logic brick AI). In a section of my script, I’m trying to create a list of all the nodes. Here is my current code:
#As usual: import GameLogic as gl cont = gl.getCurrentController() own = cont.owner scene = gl.getCurrentScene() objects = scene.objects #Building a list of the nodes: nodelist =  for i in objects: if i.name[0:6] == "OBNode": nodelist.append(i) nodelist.sort() print nodelist
The only problem with sorting the list. All of my nodes are named Node1, Node2, Node3, etc. I’d like the list to be sorted so that Node1 is the first entry, Node2 the second, etc. When I use sort(), though, I get this console output:
What am I doing wrong? I tryed using str() to make it forcibly append i to the list as a string, but all that did was give me a different scrambled output.
Any help appreciated.