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.

     flagGreen = self.findflag("green")
     flagBlack = self.findflag("black")
if flag:
  if flagGreen:  
          self.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y)
 if flagBlack:
          self.buildXY("fence", flagBlack.pos.x, flagBlack.pos.y)
     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:

    if  situation1:
         do something 
    if situation2
         do something else
.  #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:

I DID IT! Thanks Zuf!