def getZomName(self, i):
x = None
x = i.getIntoNode().getName()
lengthEntry = len((str(x)))-1
zomNum = str(x)[1:lengthEntry]
print(x)
print(zomNum)
zomName = self.zombie[(int(zomNum))]
return ZomName
This gets a zombies name from a collision entry. So the zombies name is “z0” I want to get 0 as ZomNum and run it through self.zombie list to get the name of the zombie.
It gives me:
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:display(warning): FrameBufferProperties available less than requested.
Traceback (most recent call last):
File "C:\Users\Lisa\Documents\NetBeansProjects\Zombie_Arena\src\module.py", line 206, in detectShots
zombieName = self.getZomName(x)
File "C:\Users\Lisa\Documents\NetBeansProjects\Zombie_Arena\src\module.py", line 238, in getZomName
zomName = self.zombie[(int(zomNum))]
ValueError: invalid literal for int() with base 10: ''
:task(error): Exception occurred in PythonTask detect shots
Traceback (most recent call last):
File "C:\Users\Lisa\Documents\NetBeansProjects\Zombie_Arena\src\zombie_arena.py", line 11, in <module>
gameApp.run()
File "C:\Panda3D-1.7.2\direct\showbase\ShowBase.py", line 2630, in run
self.taskMgr.run()
File "C:\Panda3D-1.7.2\direct\task\Task.py", line 502, in run
self.step()
File "C:\Panda3D-1.7.2\direct\task\Task.py", line 460, in step
self.mgr.poll()
File "C:\Users\Lisa\Documents\NetBeansProjects\Zombie_Arena\src\module.py", line 206, in detectShots
zombieName = self.getZomName(x)
File "C:\Users\Lisa\Documents\NetBeansProjects\Zombie_Arena\src\module.py", line 238, in getZomName
zomName = self.zombie[(int(zomNum))]
ValueError: invalid literal for int() with base 10: ''
z0
It is supposed to print x and zomNum, but it only prints one thing, not sure which one it is though.
Thanks.