Timber Guard help for python

while True:
    # Collect gold.
    coin= hero.findNearestItem()
    # If you have enough gold, summon a soldier.
    if hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
    soldier= hero.findFriends("soldier")
    # Use a for-loop to command each soldier.
    # For loops have two parts: "for X in Y"
    # Y is the array to loop over.
    # The loop will run once for each item in Y, with X set to the current item.
    for friend in hero.findFriends():
        if friend.type == "soldier":
            enemy = friend.findNearestEnemy()
            # If there's an enemy, command her to attack.
            # Otherwise, move her to the right side of the map.
            if enemy:
                hero.command(soldier, "attack", enemy)
            else:
                hero.command(soldier, "move", 84, 45)
            

I am having some problems with this code, for some reason the syntax duck is talking about something that is can’t quite understand.

The duck is saying that FindFriends is not finding any arguement.

You can’t add a argument in the findFriends() method. You can find the friend type by using a different method, hero.findByType("soldier",hero.findFriends())

soldier= hero.findFriends("soldier")  # this method only returns a list of all friends

This line of code isn’t really needed since you are calling the findFriends() in the for loop. Also, I see that you are not collecting the coin after you find it.

Keep in mind that in the for loop, the variable is friend and not soldier when you command them.

One last piece, the move command needs an “object” not just the numbers, like {"x": 84, "y": 45}
A little trick, put your cursor where you want to enter the position in your code and then use your mouse on the map to shows the coordinates you want; hold down Shift and left click the mouse. It will drop those coordinates into your code.