my code isnt working
while True:
# Move to the nearest coin.
# Use move instead of moveXY so you can command constantly.
items = hero.findItems()
itemIndex = 0
hero.say("I need coins!")
item = items[itemIndex]
hero.move(itemPos)
# If you have funds for a soldier, summon one.
if hero.gold > hero.costOf("soldier"):
hero.say("I should summon something here!")
hero.summon("soldier")
enemy = hero.findNearest(hero.findEnemies())
if enemy:
# Loop over all your soldiers and order them to attack.
soldiers = hero.findFriends()
soldierIndex = 0
soldier = soldiers[soldierIndex]
# Use the 'attack' command to make your soldiers attack.
#hero.command(soldier, "attack", enemy)
hero.command(soldier, "attack", target)
line 10 is the one that it sase has an error