Power points-skeletons taking too long, run out of time

#Time always runs out when I am fighting the third skeleton. What is wrong with the code?

spell = "VENI"
wizard = hero.findNearest(hero.findFriends())
powerMap = wizard.powerMap

def convert(row, col):
return {‘x’: 16 + col * 12, ‘y’: 16 + row * 12}

for i in range(len(powerMap)):
# Each row is an array. Iterate through it.
for j in range(len(powerMap[i])):
# Get the value of the i-th row and j-th column.
pointValue = powerMap[i][j]
# If it’s a positive number:
if pointValue > 0:
# Use the ‘convert’ function to get coordinates.
pos= convert(i, j)
# Move there, say “VENI”, fight or pick up an item.
hero.moveXY(pos.x, pos.y)
hero.say(“VENI”)
items = hero.findItems()
nearest = hero.findNearest(items)
if nearest:
hero.moveXY(nearest.pos.x, nearest.pos.y)
enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)
while enemy and enemy.health >0:
if hero.isReady(“bash”):
hero.bash(enemy)
else:
hero.attack(enemy)

Sorry about the indentation!
Can’t I just paste my code and keep the indentation?

Okay. I went out and bought a more powerful sword. That dealt with it!

See the FAQ — I need help with my code! if you need help formatting your code next time. :slight_smile:

Which sword did you have when get this problem?

Now I got it. There is a preformatted button!
Thanks!

It was a long sword with only 28 DPS.

Yeah, “Long sword” is not good for mountains.