[SOLVED] Stuck cloudrip commander

Hi i need some help with cloudrip commander.Here is my code:

`# Summon some soldiers, then direct them to your base.

Each soldier costs 20 gold.

hero.summon(“soldier”)
hero.summon(“soldier”)
hero.summon(“soldier”)
hero.summon(“soldier”)
hero.summon(“soldier”)

soldiers = hero.findFriends()
soldierIndex = 0

Add a while loop to command all the soldiers.

while True:
soldier = soldiers[soldierIndex]
hero.command(soldier, “move”, {“x”: 51, “y”: 41})

Go join your comrades!

hero.moveXY(51, 41)
`

please help

Hi, you need to first say, while hero’s gold is less then the cost of a soldier. And then just do hero.summon(“soldier”). Then have this soldiers = hero.findFriends() and soldierIndex = 0
Have *figure out yourself* = soldier[soldierIndex] followed by the usual soldierIndex += 1. I passed the level by moving before I summoned anything. So that was at the top of my code.

And next time, please post your code correctly.

oh sorry here is my code:
# Summon some soldiers, then direct them to your base.

# Each soldier costs 20 gold.
while hero.gold > hero.costOf("soldier"):
    hero.summon("soldier")
soldiers = hero.findFriends()
soldierIndex = 0
# Add a while loop to command all the soldiers.
while True:
    soldier = soldiers[soldierIndex]
    hero.command(soldier, "move", {"x": 50, "y": 40})

hero.moveXY(51, 41)