Coded Orders problem [Solved]


#1

I don’t know whats wrong exactly with my code. Everything seems to work perfectly. But the game say that I didn’t meet the conditions. I can’t summon paladin or artillery yet but it is supposed to be a bonus.


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

liste = []
data = ""

# Separate each actions to make and put it in a list
for i in range(len(message)):
    if (i + 1) % 5 == 0:
        data += message[i]
        liste.append(data)
        data = ""
    else:
        data += message[i]

for i in range(len(liste)):
    x = str(liste[i][1]) + str(liste[i][2])
    x = int(x)
    y = str(liste[i][3]) + str(liste[i][4])
    y = int(y)
    if liste[i][0] == "a":
        hero.summon("archer")
    elif liste[i][0] == "s":
        hero.summon("soldier")
    elif liste[i][0] == "p":
        hero.summon("peasant")
    elif liste[i][0] == "g":
        hero.summon("griffin-rider")
    elif liste[i][0] == "P":
        pass # can't summon yet
    elif liste[i][0] == "A":
        pass # can't summon yet
    units = hero.built
    currentunit = units[-1]
    if currentunit:
        hero.command(currentunit, "move", {"x":x , "y": y})

#2

Weird.

I changed the “pass” for the Paladin if loop, the level told me success, and when i changed it back, it said ran out of time. @maka is it a bug?


#3

No it is not a bug it completely make sense actually

pass, will not execute the code in the IF
but it will continue execute the rest of the code, meaning that my last unit will take the position of the paladin or the artillery

continue will ignore the complete iteration for the loop and go to the next one.
so this is why it works with continue and not with pass!

Thanks problem solved!