/* WHAT THIS DOES: Scans your phone's screen that's being mirrored to your computer to look for images of buttons you have saved, then clicks them. This makes it more reliable than autoclickers as you pretty much never have to worry about tapping the wrong button, overheating, placing tap spots in pixel perfect positions so as not to get stuck by changing targets/selecting battle rewards, or accidentally minimizing the game and tapping to call your boss at four in the morning over and over again. The timings and positions of the taps are also randomized as a slight protection against macro detection. This works by hijacking your mouse for a split second to make a click and then returning it to where it was, so it's best to use on a computer you're not using at that time, like a backup notebook, or if you're doing something not very mouse-intensive. This method also works for iPhones, but you'll need a Windows PC to run Autohotkey. HOW TO USE IT: 0. Have a windows PC, make a folder dedicated to this script somewhere 1. Download scrcpy https://github.com/Genymobile/scrcpy (scrcpy only works on Android, for iPhones you'll have to find another way to mirror your phone's screen to a PC) 2. Mirror your phone's screen to your PC (for scrcpy, follow the instructions on their page) 3. Take screenshots of buttons you want to press, save them as little cutouts to your dedicated folder make sure they are as unique as possible and .png, not .jpg 4. Download AutoHotkey, if you don't have it already https://www.autohotkey.com/ 5. Paste this script into notepad, and edit it according to your buttons and their filenames. SEE LINES HIGHLIGHTED WITH ███ 6. Save the script to your dedicated folder as a file with the .ahk extension (Save as > select All files under the name box, name it .AHK, save). Run it. You should now see the autohotkey icon in your system tray 7. Have your scrcpy/phone screen window highlighted and press F12, you should see a popup informing you of your active window, press OK and enjoy (F12 pauses the script as well) 8. Farm and laugh at scriptlets in /3vpmg/ OTHER TIPS: -If you resize your mirrored window, your images will no longer match. Make sure you don't do that. -If you're using scrcpy, you can press Ctrl+O to turn off your phone's screen but keep mirroring (relevant for OLED screens to avoid burn-in). -If you're sure your images match and aren't getting detected anyway, increase the sensitivity in the code by a bit (default 50). Don't overdo it or you might start getting false positives. If you're having the opposite problem and get a lot of FPs, decrease it. -The ImageSearch function in autohotkey works by comparing your image and the window from the top left corner line by line. If, for instance, you have an image that starts with bunch of white pixels, and the whole screen is white, searching is gonna take a while because the function is gonna stop at every single pixel to see if there's a match, so if you're having issues with speed, try to have your button images have colors unique to the screen they're on in their top left corners */ #Warn #NoEnv #SingleInstance, On CoordMode, Pixel, Screen CoordMode, Mouse, Screen CoordMode, ToolTip, Screen SetWorkingDir %A_ScriptDir% Image = m2.png|go.png|cont.png|ok.png ; ███ Button list, edit according to what you have, take note of the last one in the list (ok.png in this case) Pause WinGetTitle, WindowName, A MsgBox, The active window is %WindowName%. ParseButton: Loop, Parse, Image, |, { WinGetPos, XOff, YOff, Width, Height, %WindowName% XMax := XOff + Width YMax := YOff + Height Tooltip, Searching for %a_loopfield%, XOff, YOff, 1 ImageSearch, ImageX1, ImageY1, XOff, YOff, XMax, YMax, *50 %a_loopfield% ; Adjust the number after the asterisk to increase/decrease sensitivity 0-255 (the higher the # the less strict the image search is) Random, ImageX, ImageX1, ImageX1+25 ; numbers after ImageX1: Variance in position of the clicks in the X direction (in pixels). Should be no bigger than the width/height of your smallest button Random, ImageY, ImageY1, ImageY1+25 ; numbers after ImageY1: Variance in position of where it will click relative to the upper left corner in the Y direction. Random, Delay, 0.04, 0.08 if ErrorLevel = 2 { MsgBox Error searching for %a_loopfield%. } else if Errorlevel = 1 { if a_loopfield = ok.png ; ███ The last image from your list must go here { Goto ParseButton } else { Continue } } else { Tooltip, %a_loopfield% pressed., XOff, YOff+23, 2 if a_loopfield = ok.png ; ███ The last image from your list must go here { ClickRandom(ImageX,ImageY,1,Delay) TimedSleep(Delay) Goto ParseButton } else { ClickRandom(ImageX,ImageY,1,Delay) TimedSleep(Delay) Continue } } } f10::ExitApp ;Force close the script hotkey f11::Reload ;Reload the macro hotkey f12::Pause ;Start the macro/pause the macro hotkey Randomize(Rmin,Rmax) { Random, OutputR, %Rmin%, %Rmax% Return OutputR } TimedSleep(S) { SleepMultiple := Randomize(800, 1000) Sleep, SleepMultiple * S return } ClickRandom(ImageX, ImageY, ClickCount, Pause) { MouseGetPos MouseX, MouseY Loop %ClickCount%{ MouseClick, Left, %ImageX%, %ImageY%, 1, 0, D TimedSleep(Pause/2) MouseClick, Left, %ImageX%, %ImageY%, 1, 0, U TimedSleep(Pause/2) } MouseMove %MouseX%, %MouseY%, 0 }