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

Please help me with error message in level: "Cloud-rip Commander"{SOLVED}

So i’m on the mountain place on level: cloudrip commander and this is my code:
def summonSoldier():
# Заполни код здесь, что призвать солдата, если у тебя достаточно золота.
if hero.gold > hero.costOf(“soldier”):
hero.summon(“soldier”)

commands attack

def commandSoldiers():
for soldier in hero.findByType ‘soldier’:
hero.command(soldier, “move”, {‘x’: 50, ‘y’: 41})

while True:
enemies = hero.findEnemies()
index = 0
distanse = 99999
enemy = None
while index < len(enemies):
if enemies[index].type != “sand-yak” and distanse > hero.distanceTo(enemies[index]):
distanse = hero.distanceTo(enemies[index])
enemy = enemies[index]
index += 1
items = hero.findItems()
if len(items) > 0:
pickUpNearestCoin()
summonSoldier()
commandSoldiers()
but where it says:
for soldier in hero.findByType ‘soldier’:
it says there’s an error in the code this is the message:
unexpected token: expected T_COLON but found T_STRING while parsing for_stmt
can anybody tell me what i’m doing wrong.
Thanks in advance
Kind Regards,
Sarah B

I can’t tell if there are any formatting problems, but it looks like you are missing the () in your commandSoldiers function.

for soldier in hero.findByType ‘soldier’: # hero.findByType('soldier'):

oh my goodness i don’t know how i missed that thanks so much @brooksy125
thanks,
kind regards
Sarah B

never mind fixed
thanks for all your help @brooksy125
kind regards
Sarah B

Glad I can help! :nerd_face: