[SOLVED] Mixed Unit Tactics - Python

Hi @ZAX155,
I think you’re code needs a bit of… restructuring.
Let’s look at this on a large scale, because you’re problem is on a large scale (the error message is the least of your worries I’m afraid)

The overall structure of your code at the moment is:

for friend in friends:
    summonTypes
    def summonTroops():
    def collectCoins():
    def commandTroops():
    while True:
        # call functions

Why are you defining the functions and running the while True loop inside a for loop? You don’t need to run all that code for each friend, you only want to run the command code for each friend.
What I’m trying to say is: when you command your friends- use a for loop! Every time, it’s simply the best option. (you will have to put it in the commandTroops function)

Also please could you limit how many posts you make, you could edit the original post to change your code rather than making multiple long posts.
Thanks, I hope this helps
Danny

1 Like