Coded Orders help Please!

Hello everyone,

I do not know what is happening!!

# Read the message on the sign to determine which units to summon and where to place them.
# Check the guide for instructions on interpreting the orders.

sign = hero.findByType("sign")[0]
message = sign.message

# Tip: parse the sign, then summon the units, then send each unit to the right position.

split_strings = []
n  = 5
for index in range(0, len(message), n):
    split_strings.append(message[index : index + n])




while True:
    friends = hero.findFriends()
    for i in range(10):
        for friend in friends:
            if split_strings[i][0] == 'p':
                hero.summon('peasant')
                if friend.type == 'peasant':
                    number10 = int(split_strings[i][1])*10 + int(split_strings[i][2])
                    number11 = int(split_strings[i][3])*10 + int(split_strings[i][4])
                    hero.command(friend, 'move', {'x':number10, 'y': number11})
            elif split_strings[i][0] == 's':
                if friend.type == 'soldier':
                    number10 = int(split_strings[i][1])*10 + int(split_strings[i][2])
                    number11 = int(split_strings[i][3])*10 + int(split_strings[i][4])
                    hero.command(friend, 'move', {'x':number10, 'y': number11})
            elif split_strings[i][0] == 'P':
                hero.summon('paladin')
                if friend.type == 'paladin':
                    number10 = int(split_strings[i][1])*10 + int(split_strings[i][2])
                    number11 = int(split_strings[i][3])*10 + int(split_strings[i][4])
                    hero.command(friend, 'move', {'x':number10, 'y': number11})
            elif split_strings[i][0] == 'g':
                hero.summon('griffin-rider')
                if friend.type == 'griffin-rider':
                    number10 = int(split_strings[i][1])*10 + int(split_strings[i][2])
                    number11 = int(split_strings[i][3])*10 + int(split_strings[i][4])
                    hero.command(friend, 'move', {'x':number10, 'y': number11})
            elif split_strings[i][0] == 'a':
                hero.summon('archer')
                if friend.type == 'archer':
                    number10 = int(split_strings[i][1])*10 + int    (split_strings[i][2])
                    number11 = int(split_strings[i][3])*10 + int(split_strings[i][4])
                    hero.command(friend, 'move', {'x':number10, 'y': number11})
            elif split_strings[i][0] == 'A':
                if friend.type == 'artillery':
                    number10 = int(split_strings[i][1])*10 + int    (split_strings[i][2])
                    number11 = int(split_strings[i][3])*10 + int(split_strings[i][4])
                    hero.command(friend, 'move', {'x':number10, 'y': number11})
    

pLeAsE hELp mE

what do you need help with? and you should probably make it use variables instead of using like 5 else ifs

Hey dude welcome back :tada: i’ve watched alot of
your videos. I have’nt played codecombat for a bit
So i ca’nt help you

1 Like

The artillery moves and then some peasants move and then only 1 archer moves, and I do not get why this happens??

Thanks man!! (20 CHARACTERS GO brrrrrrr)

Use for i range(len(friends)) instead of for i in range(10), remove the for friend in friends, add friend = friends[i] and then it should work

1 Like

I still have a problem with the moving part, it says that number10 and number11 are not numbers.

Cheers,
ColdFire

IDK about that ;-; wrap it in int?

Let me try that?!? (20 Characters WHYYYY)