Below is a script intended to press the up arrow key every time a pixel of
#535353 is encountered at
555,888. This is intended to create a bot for the Chrome dino game. However, for some reason the script does not always successfully press the up arrow when a cactus passes through
555,888. I reason this to be because the script isn't running the shell command to test the pixel frequently enough.
Is there a more efficient way to test for the color of an onscreen pixel such that I can test for it more times per second?
repeat set px to "" set px to (do shell script "screencapture -R555,888,1,1 -t bmp $TMPDIR/test.bmp && xxd -p -l 3 -s 54 $TMPDIR/test.bmp | sed 's/\\(..\\)\\(..\\)\\(..\\)/\\3\\2\\1/'") if px contains "535353" then tell application "System Events" key code 126 end tell end if end repeat