Error: Attempt to invoke bookmark for [Function], what does this mean?


#1

I’m on the “Brittle Morale” level in the Sarven Desert thing. Even though I’m sure the code will work, it just keeps bringing this stupid error: “Attempt to invoke bookmark for [Function]”. I’ve checked another topic about this issue, but it doesn’t help at all.

Here’s my code (I’m using Python):

def findStrongestEnemy(enemies):
    strongest = None
    strongestHealth = 0
    enemyIndex = 0
    # While enemyIndex is less than the length of enemies:
    while enemyIndex < len(enemies):
        # Set an enemy variable to enemies[enemyIndex]
        enemy = enemyIndex[enemies]
        # If enemy.health is greater than strongestHealth
        if enemy.health > strongest.health:
            # Set strongest to enemy
            strongest = enemy
            # Set strongestHealth to enemy.health
            strongestHealth = enemy.health
        # Increment enemyIndex
        enemyIndex += 1
    return strongest

enemies = hero.findEnemies()
leader = findStrongestEnemy(enemies)
hero.say(leader)

SOLVED. Nothing here. 😗🎶
#2

I tried out your code, but for some reason, the website did not bring up any errors. I’m not sure if there is some sort of bug in the level?

Or maybe it has something to do with the equipment that is being used? According to When do I get which Item - A reference, you start being granted access to arrays when you receive Programmaticon III. By the time you reach Brittle Morale, you should have passed Medical Attention, which is where you get that Programmaticon. Do you have Programmaticon III equipped?

I am trying to help you out as much as possible, but I would just like to let you know that I am not exactly an expert on CodeCombat. If this advice works out, then I’m glad to help. If it does not, there’s a possibility that there is a bug in the level, and you might want to try notifying the leader.

Happy to help (or at least try to),
Hellenar


#3

I do have Programmaticon ||| with me, so it must be a bug.


#4

Thanks for letting me know! :smiley:

I will see if I can contact the leader as soon as I can.


#5

I started a new topic and posted a link to this topic; I hope that’s okay with you.
Hope people will start to resolve this and similar issues soon.

If you still need my help in case other bugs start appearing, just type @Hellenar
I will try to get Nick’s (or others’) attention like I just did with Brittle Morale.


#6

enemy = enemyIndex[enemies] - this is wrong, enemyIndex is not an array. Enemies is an
array


#7

Thanks @Maksym_Radchenko!


#8

Thanks, now it works!