Siege of Stonehold help needed!

enemy = hero.findNearestEnemy()
flag = hero.findFlag("green")
if enemy:
    distance = hero.distanceTo(enemy)
    if hero.health < 200:
        hero.moveXY(19, 69)
    elif flag:
        hero.pickUpFlag(flag)
    elif hero.isReady("cleave") and distance < 5:
        hero.cleave(enemy)
    elif hero.isReady("bash") and distance < 10:
        hero.bash(enemy)
    elif distance < 20:
        hero.attack(enemy)
    else:
        hero.moveXY(53, 69)

This is my code and I can’t figure out what’s wrong. Tharin doesn’t move.

You must have a while True loop

I changed it and it still doesn’t work

while True:
    enemy = hero.findNearestEnemy()
    flag = hero.findFlag("green")
    if hero.health < 200:
        hero.moveXY(19, 69)
    elif flag:
        hero.pickUpFlag(flag)
    elif enemy:
        hero.attack(enemy)
    else:
        hero.moveXY(19, 69)

This fixed it, topic closed.