Skip to content

Instantly share code, notes, and snippets.

@whalemare
Created January 19, 2021 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whalemare/4b23d56562cd746d92df8e3287f867cf to your computer and use it in GitHub Desktop.
Save whalemare/4b23d56562cd746d92df8e3287f867cf to your computer and use it in GitHub Desktop.
Farm points in Siege PS4
set O to 53
set X to 36
set keyUp to 126
set keyDown to 125
set keyLeft to 123
set keyRight to 124
set countRepeat to 0
set minOk to 15
set maxOk to 17
on keyboard(code)
tell application "System Events"
tell application "RemotePlay" to activate
key code code
-- set visible of process "PS Remote Play" to false
end tell
delay 0.5
end keyboard
on notify(value)
tell application "RemotePlay" to activate
display notification "Farm" with title "Farming" subtitle value sound name "Frog"
end notify
global repeatScreenshotCount
set repeatScreenshotCount to 150
on findAndReplaceInText(theText, theSearchString, theReplacementString)
set AppleScript's text item delimiters to theSearchString
set theTextItems to every text item of theText
set AppleScript's text item delimiters to theReplacementString
set theText to theTextItems as string
set AppleScript's text item delimiters to ""
return theText
end findAndReplaceInText
on screenshot(stepValue)
log "stepValue: " & stepValue & " of " & repeatScreenshotCount
if stepValue < repeatScreenshotCount then
set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "new.png"
tell application "RemotePlay" to activate
do shell script "screencapture -R0,0,1135,683 -tpng" & space & quoted form of thePath
try
set diff to do shell script "/usr/local/bin/magick compare -metric PSNR /Users/whalemare/Desktop/original.png /Users/whalemare/Desktop/new.png /Users/whalemare/Desktop/diff.png"
on error errmsg number errnr
set percent to findAndReplaceInText(errmsg, ".", ",") as number
log "percent is: " & percent
if percent > 30 and percent < 100 then
log "GAME IS ENDED 🥳"
-- files are not equal; no error
else
delay 1
screenshot(stepValue + 1)
end if
end try
end if
end screenshot
repeat
set countRepeat to (countRepeat + 1)
-- exit game
log "Start game #" & countRepeat & ", you farmed " & countRepeat * 50 - 50
delay 5
keyboard(O)
delay 1
keyboard(O)
keyboard(X)
delay 10
-- select location
log "select location"
keyboard(keyDown)
keyboard(keyDown)
keyboard(keyDown)
keyboard(X)
delay 1.5
-- select doc
log "select doc"
keyboard(keyDown)
keyboard(keyRight)
keyboard(keyRight)
keyboard(keyRight)
keyboard(keyRight)
keyboard(X)
delay 1
-- ready
log "ready"
keyboard(X)
-- sit down
delay 25
log "sit down"
keyboard(O)
-- wait game end
log "wait game end"
screenshot(0)
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment