A level I am struggling at. "Sarven Sentry."

Hey. I am having a struggle on a level called “Sarven Sentry.” The goal is to fence out the yaks, but to kill the ogres. Here is my code.

loop:
     flagGreen = self.findflag("green")
     flagBlack = self.findflag("black")
if flag:
  if flagGreen:  
          self.pickUpFlag()
          self.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y)
 if flagBlack:
          self.pickUpFlag()
          self.buildXY("fence", flagBlack.pos.x, flagBlack.pos.y)
else:
     self.moveXY(43, 31)

The things I noticed is that my hero is not moving anywhere. I also did not see any error when I typed this code. Can you help me on this?

Flag is null because you are not assign it (flag=…) anywhere in your code
So if(flag) always fails

Use continue to skip at the end of the loop:

loop:
    if  situation1:
         do something 
         continue
    if situation2
         do something else
         continue
.  #and so on ..............................
   nothing special happens do boring stuff here
#end of loop

I have an error saying to pass a flag object to pick up. What does that mean.

That could mean that you need to specify the flag to pick up, for example:

if flagGreen:
    self.pickUpFlag(flagGreen)

I DID IT! Thanks Zuf!