This version is working flawlessly for me. Thank you so much Safar. You da man!
One suggestion though if possible. Drop maybe 20 or so troops on the town hall and then wait a little while. Run a town hall check and if it is still there drop 20 more just in case there were bombs or something that killed your troops and wait a while longer. If its still there, likely due to teslas or something, drop the remaining troops. If the town hall is missing for any of these checks either use the rest of the troops in the normal attack algorithm or end battle. Right now I'm using barbarians because of the update so the turn over is incredibly fast so it doesn't really matter but it would be a waste to use the entire army in most other situations. None the less, this resolved all issues I had previously and I would really like to thank you for all your hard work here.
edit: An issue I just ran into. When the client desyncs the bot continues trying to search and gets stuck at the home base clicking where the next button would be. It however doesn't happen every time and I'm not sure why.
One suggestion though if possible. Drop maybe 20 or so troops on the town hall and then wait a little while. Run a town hall check and if it is still there drop 20 more just in case there were bombs or something that killed your troops and wait a while longer. If its still there, likely due to teslas or something, drop the remaining troops. If the town hall is missing for any of these checks either use the rest of the troops in the normal attack algorithm or end battle. Right now I'm using barbarians because of the update so the turn over is incredibly fast so it doesn't really matter but it would be a waste to use the entire army in most other situations. None the less, this resolved all issues I had previously and I would really like to thank you for all your hard work here.
edit: An issue I just ran into. When the client desyncs the bot continues trying to search and gets stuck at the home base clicking where the next button would be. It however doesn't happen every time and I'm not sure why.