zebscripts/AFK-Daily

Script waits forever in the Arena of Heroes

Zebiano opened this issue · 1 comments

This bug is caused because the script is supposedly waiting for an Arena of Heroes battle to finish (Victory or Defeat screen), but since the script never entered a battle in the first place, it'll wait forever. This happens because sometimes the amount of players you are able to challenge is 4 and not 5 (problem with Lilith) changes because you move positions in the leaderboard, which means there might be fewer opponents to fight. The script tries to fight against a player that doesn't exist, resulting in no battle starting.

The workaround for now is manually starting a new Arena of Heroes fight. When the fight is over, the script should be able to continue on its own again.

As for a fix, most likely an RGB check if the battle screen popped up or not would be the way to go.

I'm doing a quick fix, will see tomorrow if it works. I need to update the colors... and check if it's still working whether you use Arena Tickets or not...
I added a control to look for the button for the 4th and 5th opponents:

            4)
                getColor 820 1220
                if [ "$RGB" == "aff3c0" ]; then # Looking for the button
                    input tap 820 1220 # Opponent 4
                else
                    input tap 820 1050 # Opponent 3
                fi
                ;;
            5)
                getColor 820 1400
                # Fix: Script waits forever in the Arena of Heroes #33
                if [ "$RGB" == "aaf2bb" ]; then # Looking for the button
                    input tap 820 1400 # Opponent 5
                else
                    getColor 820 1220
                    if [ "$RGB" == "aff3c0" ]; then # Looking for the button
                        input tap 820 1220 # Opponent 4
                    else
                        input tap 820 1050 # Opponent 3
                    fi
                fi
                ;;

Will PR if it's working.