Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Sarven Treasure - Python


I am trying to complete this level by having my character just run and pick up gold at first and then start fighting. All during this time I wan’t to be able to us a flag to tell my character to go to a teleporter. When I run the code it says "Hard execution limit of 3000000 reached? Any help or suggestions would be great. Thank you.

    items = self.findItems()
    item = self.findNearest(items)
    enemies = self.findEnemies()
    enemy = self.findNearest(enemies)
    green = self.findFlag("green")
    black = self.findFlag("black")
    violet = self.findFlag("violet")
    flags = self.findFlags()
    while > 1000:    
        if item:
            self.moveXY(item.pos.x, item.pos.y)
        elif flags:
            if green:
    while < 1000 and > 500:
         if enemy:
            if self.distanceTo(enemy) < 10:
                if self.isReady("cleave"):
        elif item:
            self.moveXY(item.pos.x, item.pos.y)
        elif flag:
            if green:


what do you have
speed ring and softened leather boots are recommended
and also any good sword at least 200 damage


That means you have an infinite loop somewhere. Can you see any such loops in your code?
You might want to replace the parts with while with if and else if.


You must update your world view (search for items, enemies, flags … inside each while loop
Otherwise will be stuck in the first while loop, you’ll pick the only item you searched for, and the do nothing until you run out of instructions.

An empty while loop will be executed a million of times in less than a fraction of a second.


OK thank you very much!