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

[SOLVED] Sarvern Sentry, Python

There is a problem where the fence is not buildable, when the code says to build a fence.
Here’s my code:

# Use different colored flags to perform different tasks.
while True:
    flagGreen = hero.findFlag("green")
    flagBlack = hero.findFlag("black")
    # If there's a flagGreen...
    if flagGreen:
        # Build a "fence" at flagGreen's position.
        hero.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y)
        # Pick up the flag!
    # If there's a flagBlack...
    if flagBlack:
        # Build a "fire-trap" at flagBlack's position.
        hero.buildXY("fire-trap", flagBlack.pos.x, flagBlack.pos.y)
        # Pick up the flag!
    # Move back to the center.
    hero.moveXY(43, 31)

The Error that the Editor Gives:

What hammer are you using?


Oh, thanks! Sorry. It was the hammer I was using, and I needed to use a better one that could build a fence.

Wait a second, I’m actually using the Wooden Builder’s thingy and it allows you to build a fence, but it doesn’t allow me.

1 Like

Sorry about not getting back to you sooner. I was at my school’s graduation ceremony.

As for your code, lets go find all possible issues. Try reloading the level.


No. The code worked for me. Maybe try to equip the crude builder’s hammer and it will work just fine (or try with the one that also builds decoys but not arrow-towers).



Interesting. Reloaded and it worked. Thanks for your help!

1 Like