Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Siege of stokehold won't work

I am at siege of stokehold and My character won’t move to pick up flags or anything. I’m not subscribed, am a beginner to code. I’m learning Python.

Here’s my code:
’ ’ ’
enemy= hero.findNearestEnemy()
flag=hero.findFlag()
green= hero.findFlag(‘green’)
black= hero.findFlag(‘black’)
while True:

if flag:
    if flag.color is 'green':
        hero.moveXY(19, 69)
    elif flag.color is "black":
        hero.move(flag.pos.x, flag.pos.y)
        hero.pickUpFlag(black)
        hero.attack(enemy)
    else:
        if hero.isReady('cleave'):
            hero.cleave(enemy)
        else:
            hero.attack(enemy)

’ ’ ’
Thanks for the help,
Raven

please format your code good so we can see your problem

in

   elif flag.color is "black":
        hero.move(flag.pos.x, flag.pos.y)
        hero.pickUpFlag(black)
        hero.attack(enemy)

hero.attack(enemy)
use an if-statement
(like if enemy and flag)