# The Trial in Sarven driving me mad- Python

**URL:** <https://discourse.codecombat.com/t/the-trial-in-sarven-driving-me-mad-python/10334>\
**Category:** Uncategorized\
**Created:** [January 22, 2017, 5:48pm UTC](https://discourse.codecombat.com/t/the-trial-in-sarven-driving-me-mad-python/10334 "2017-01-22T17:48:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Horton](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nicholas_horton/32/5621_2.png) [@Nicholas\_Horton](https://discourse.codecombat.com/u/Nicholas_Horton)\
**Post date:** [January 22, 2017, 5:48pm UTC](https://discourse.codecombat.com/t/the-trial-in-sarven-driving-me-mad-python/10334/1 "2017-01-22T17:48:30Z")

</div>

I’m just not understanding the error I’m getting. It keeps saying it’s trying to call a function. I feel like in the code below that all I should need to finish the level is to input the rest of the variables for locations. I’m using limited length glasses. Don’t know if that matters. Thanks in advance.

locationIndex = 0  
locations = [[132,24]]

while locationIndex \< len(locations):  
enemies = hero.findEnemies()  
enemyIndex = 0  
mushrooms = hero.findItems()  
itemIndex = 0

```
if enemyIndex < len(enemies):
    enemy = hero.findNearest(enemies)
    if enemy:
        if enemy.health > 0:
            hero.attack(enemy)
        else:
            enemyIndex +=1
            
    
    
elif itemIndex < len(mushrooms) and enemyIndex == 0:
    mush = hero.findNearest(mushrooms)
    if mush:
        hero.moveXY(mush.pos.x,mush.pos.y)
        itemIndex += 1
    
            
else:
    hero.moveXY(locationIndex[locations[0]],locationIndex[locations[1]])
    locationIndex += 1

```

edit: I just realized a lot of this code, like the enemy and item arrays, might be excessive. Still, even if I took away the stuff and made it simpler, pretty sure it would perform the same.

---

<div class="post-metadata">

**Author:** ![jack225](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jack225/32/5644_2.png) [@jack225](https://discourse.codecombat.com/u/jack225)\
**Post date:** [January 23, 2017, 3:20am UTC](https://discourse.codecombat.com/t/the-trial-in-sarven-driving-me-mad-python/10334/2 "2017-01-23T03:20:36Z")

</div>

#not:  
locationIndex = 0  
locations = [[132,24]]  
#but:  
locationIndex = 0  
locations = [[30,20],[41,21],[52,22],[63,23][74,24],[85,25],[96,26],[107,27],[118,28],[129,29],[132,24],…]

---

<div class="post-metadata">

**Author:** ![jack225](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jack225/32/5644_2.png) [@jack225](https://discourse.codecombat.com/u/jack225)\
**Post date:** [January 23, 2017, 6:07am UTC](https://discourse.codecombat.com/t/the-trial-in-sarven-driving-me-mad-python/10334/3 "2017-01-23T06:07:01Z")

</div>

#not:  
hero.moveXY(locationIndex[locations[0]],locationIndex[locations[1]])  
locationIndex += 1  
#but:  
hero.moveXY(locations[locationIndex][0], locations[locationIndex][1])  
locationIndex += 1

---

<div class="post-metadata">

**Author:** ![Nicholas\_Horton](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nicholas_horton/32/5621_2.png) [@Nicholas\_Horton](https://discourse.codecombat.com/u/Nicholas_Horton)\
**Post date:** [January 23, 2017, 5:29pm UTC](https://discourse.codecombat.com/t/the-trial-in-sarven-driving-me-mad-python/10334/4 "2017-01-23T17:29:33Z")

</div>

I need help with the “Attempted to invoke bookmark for [Function]”  
:nevermind! Thanks Jack. I didn’t do exactly what you said, but you did prompt me to remember how to set up the array index affecting the location properly as it’s own value. I should be good now.
