Endangered Burl - Loop Not Repeating?

Yet another ‘Endangered Burl’ question. I’ve checked out several other posts, but haven’t seen my question come up.

My Python script is below. Each time I run it, the character goes through the loop one time and then terminates instead of restarting the loop. The initial enemy is a burl, so the character runs to the village- and the program ends.

Any hints? Thanks in advance.

loop:
    enemy = self.findNearestEnemy()
    if enemy:
        if enemy.type is 'munchkin':
            self.attack(enemy)
        elif enemy.type is 'thrower':
            self.attack(enemy)
        elif enemy.type is 'burl':
            self.moveXY(22, 47)
        else:
            self.say("I/'ve never seen anything like it.")
    else:
        pass

Burls are the big enemies. They will pass you over, and not initially try to attack you, so I would not move to the village for the burl. You are supposed to go to the village when you see the ogre. so it would be better to have something like

loop:
    enemy = self.findNearestEnemy()
    if enemy:
        if enemy.type is 'munchkin':
            self.attack(enemy)
        elif enemy.type is 'thrower':
            self.attack(enemy)
        elif enemy.type is 'burl':
            #Do a command that will ignore the burl in some way or not harm the burl
        elif enemy.type is 'ogre':
            #code goes here
    else:
        pass

Something like that might work better for you.
Good luck!

1 Like

When you go to the village it stops the game. Try changing the self.moveXY(22, 47) to something else.