-
-
Save Sniffx/ee5ae43d42894a6499c24b66586cc10c to your computer and use it in GitHub Desktop.
Revisions
-
Sniffx revised this gist
Jun 8, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,8 +60,8 @@ F5:: ;Start fishing when pressing F5 ElapsedTime := FormatSeconds(ElapsedSeconds) ;measures how much time it takes to do 1 loop ;Time every loop ElapsedTime2 := FormatSeconds2(ElapsedSeconds) ;measures how much time it takes to do 1 loop ;Time every loop xToolTipPos:= xWindowPos + 16 yToolTipPos:= yWindowPos + hWindowHeight -42 ToolTip, Enabled: %ElapsedTime% - Loop: %A_Index% , xToolTipPos, yToolTipPos ;Tooltip at the botton-left of the Destiny 2 window where it shows the script is active and during how much time. loop, -
Sniffx revised this gist
Jun 8, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ SendMode Input SetWorkingDir, %A_ScriptDir% CoordMode, ToolTip, Screen ;for tooltip position controller := new ViGEmDS4() ;Create a new virtual PS4 controller pToken := Gdip_Startup() ;Initialize capture image zone script (Gdip_all.ahk) -
Sniffx revised this gist
Jun 8, 2023 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,16 @@ ;afk fishing macro for destiny 2. You will need to install the Gdip_all library which you can find here: https://www.autohotkey.com/boards/viewtopic.php?t=6517 ;The virtual controller from the instructions here: https://github.com/A2TC-YT/Tabbed-Out-AFK ;F5 Starts the script ;F6 Stops the script ;F8 Completely exits the script ;Destiny 2 "Window Mode" must be set to "Windowed" ;Destiny 2 "Resolution" must be set to "1280x720" ;You can put Destiny 2 window anywhere but it must be visible. It must not be covered by any other window (at least not the center of the window where we check for fish). ;You can do anything else while you fish, like use the browser. #SingleInstance, Force ;Only 1 "auto_fishing.ahk" can run at the same time #Persistent #include <AHK-ViGEm-Bus> ;Needed for PS4 controller support -
Sniffx revised this gist
Jun 8, 2023 . No changes.There are no files selected for viewing
-
Sniffx revised this gist
Jun 8, 2023 . No changes.There are no files selected for viewing
-
Sniffx revised this gist
Jun 8, 2023 . No changes.There are no files selected for viewing
-
Sniffx revised this gist
Jun 8, 2023 . No changes.There are no files selected for viewing
-
Sniffx revised this gist
Jun 8, 2023 . No changes.There are no files selected for viewing
-
Sniffx revised this gist
Jun 8, 2023 . No changes.There are no files selected for viewing
-
Sniffx revised this gist
Jun 8, 2023 . 1 changed file with 156 additions and 65 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,78 +1,169 @@ #SingleInstance, Force ;Only 1 "auto_fishing.ahk" can run at the same time #Persistent #include <AHK-ViGEm-Bus> ;Needed for PS4 controller support #Include %A_ScriptDir%\Gdip_all.ahk ;Needed for image comparation support SendMode Input SetWorkingDir, %A_ScriptDir% CoordMode, ToolTip, Screen controller := new ViGEmDS4() ;Create a new virtual PS4 controller pToken := Gdip_Startup() ;Initialize capture image zone script (Gdip_all.ahk) F5:: ;Start fishing when pressing F5 { WinGetPos, xWindowPos, yWindowPos, wWindowWidth, hWindowHeight, ahk_exe destiny2.exe ;Get the position and size of "Destiny 2" xOriginalWindowPos:=6 yOriginalWindowPos:=1400 xOriginalCaptureZone:=638 yOriginalCaptureZone:=1924 xCaptureZone:= xOriginalCaptureZone + xWindowPos - xOriginalWindowPos yCaptureZone:= yOriginalCaptureZone + yWindowPos - yOriginalWindowPos coords:= xCaptureZone "|" yCaptureZone "|24|12" ;Coordinates and size of the image we will use to check if we must cast or recover the fishing line. width := 24 height := 13 threshold := 0.03 ; We look for White stuff to determine if we can cast or recover the fishing line like the words "Go fishing" or "Perfect catch" ; a higher threshold like 0.12 helps with false positives like identifying the white "vex milk" as the white words. ; a lower threshold like 0.03 is useful in Nexus Gosub, CheckCapsState ; If keyboard "Capslock" is enabled, disable it. Don't know why but when it is enabled AHK scripts behave weird in Destiny 2 controller.Buttons.Square.SetState(true) ;Initial fishing cast using the virtual gamepad. Equivalent to pressing the button "E" on the keyboard. Sleep, 800 ; DO NOT CHANGE controller.Buttons.Square.SetState(false) ;We release the button. Equivalent to stop touching the "E" key on the keyboard. Sleep, 250 StartTime := A_TickCount ;measures how much time it takes to do 1 loop ;Time every loop timeloop:=A_TickCount ;measures how much time it takes to do 1 loop ;Time every loop Loop, { ElapsedSeconds := round((A_TickCount - StartTime) / 1000) ;measures how much time it takes to do 1 loop ;Time every loop ElapsedMinutes := round(elapsedseconds /60) ;measures how much time it takes to do 1 loop ;Time every loop ElapsedTime := FormatSeconds(ElapsedSeconds) ;measures how much time it takes to do 1 loop ;Time every loop ElapsedTime2 := FormatSeconds2(ElapsedSeconds) ;measures how much time it takes to do 1 loop ;Time every loop xToolTipPos:= xWindowPos yToolTipPos:= yWindowPos + hWindowHeight ToolTip, Enabled: %ElapsedTime% - Loop: %A_Index% , xToolTipPos, yToolTipPos ;Tooltip at the botton-left of the Destiny 2 window where it shows the script is active and during how much time. loop, { pBitmap := Gdip_BitmapFromScreen(coords) ;Capture a region of the screen pWhite := simpleColorCheck(pBitmap, width, height) ;Check for White on that captured region Gdip_DisposeImage(pBitmap) ;release the memory used for the captured region if (pWhite >= threshold) ;Check if we found enough whiteness Break ;YES! We found whiteness so we interrupt this loop to cast or recover the fishing line } controller.Buttons.Square.SetState(true) ;Cast or recover the fishing line Sleep, 800 controller.Buttons.Square.SetState(false) ;Cast or recover the fishing line ElapsedMS := A_TickCount - timeloop ;Time every loop timeloop := A_TickCount ;Time every loop if (Mod(A_Index,5)=0 ){ ;ANTI AFK stuff. Every few iterations we slightly move left or right to avoid being kicked AND getting fish nearby us. There is a limit of fish on the ground. sleep, 2500 ;That limit is around 60? If more fish is on the ground, old fish gets despawned . controller.Buttons.Square.SetState(true) ;Slightly press a virtual controller button so the game recognized there is controller connected. Sleep, 100 controller.Buttons.Square.SetState(false) ;Release slightly pressed button sleep, 150 ;Note: If we don't do this, Destiny 2 doesnt recognize the below lines that we use to move left or right. Super weird OoO controller.Axes.LX.SetState(100) ; Slightly move left sleep 100 controller.Axes.LX.SetState(50) ; Stop moving sleep 150 controller.Axes.LX.SetState(0) ; Slightly move Right sleep 100 controller.Axes.LX.SetState(50) ; Stop moving } } } Return simpleColorCheck(pBitmap, w, h) ;Function to check for white stuff { x := 0 y := 0 white := 0 total := 0 loop %h% { loop %w% { color := (Gdip_GetPixel(pBitmap, x, y) & 0x00F0F0F0) if (color == 0xF0F0F0) white += 1 total += 1 x+= 1 } x := 0 y += 1 } pWhite := white/total return pWhite } F6::Reload ;Stop fishing when pressing F6 F8::ExitApp ;Stop fishing AND exit "auto_fishing.ahk" ;================================================== ;Helper Functions CheckCapsState: bCapsLockState := GetKeyState("Capslock", "T") ; 1 if CapsLock is ON, 0 otherwise. IF (bCapsLockState== 1) { SetCapsLockState OFF sleep, 500 send, {Esc} sleep 500 } return ;================================================== RemoveToolTip: ToolTip return ;================================================== ;================================================== CreateToolTip(sMsg,delay:=0,xCoord:=1,yCoord:=720){ Tooltip, %sMsg%, xCoord,yCoord SetTimer, RemoveToolTip, -1500 sleep, %delay% } ;================================================== FormatSeconds(NumberOfSeconds) ; Convert the specified number of seconds to hh:mm:ss format. { time = 19990101 ; *Midnight* of an arbitrary date. time += %NumberOfSeconds%, seconds FormatTime, mmss, %time%, mm:ss return NumberOfSeconds//3600 ":" mmss ; This method is used to support more than 24 hours worth of sections. } ;================================================== FormatSeconds2(NumberOfSeconds) ; Convert the specified number of seconds to hh:mm:ss format. { time = 19990101 ; *Midnight* of an arbitrary date. time += %NumberOfSeconds%, seconds FormatTime, mmss, %time%, mm return NumberOfSeconds//3600 "h" mmss ; This method is used to support more than 24 hours worth of sections. } ;================================================== CommaAdd(num) { VarSetCapacity(fNum,32) DllCall("GetNumberFormat",UInt,0x0409,UInt,0,Str,Num,UInt,0,Str,fNum,Int,32) return SubStr(fNum,1,StrLen(fNum) - 3) } -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 20 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,35 @@ #SingleInstance, Force SendMode Input SetWorkingDir, %A_ScriptDir% global 1080p := 0 MsgBox, ***READ BEFORE USING***`nMake sure you are on 7 brightness, chromatic abberation is off, and hud opacity is max. Make sure you have interact bound to "E". Press F3 to start and F4 to stop. Does NOT work on Nessus. InputBox, 1080p, Resolution, If your computer monitor resolution is 1440p enter 0`nIf your computer monitor is 1080p enter 1 pToken := Gdip_Startup() F3:: { coords := "1243|971|37|21" width := 37 height := 21 threshold := 0.16 if (1080p) { coords := "932|728|27|16" width := 27 height := 16 threshold := 0.12 } Loop, { loop, { pBitmap := Gdip_BitmapFromScreen(coords) pWhite := simpleColorCheck(pBitmap, width, height) Gdip_DisposeImage(pBitmap) if (pWhite >= threshold) Break } Send, {e down} -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,4 +61,4 @@ simpleColorCheck(pBitmap, w, h) F4::Reload #Include %A_ScriptDir%\Gdip_all.ahk -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,9 +21,9 @@ F3:: Send, {e down} Sleep, 800 Send, {e Up} DllCall("mouse_event",uint,1,int,-300,int,0,uint,0,int,0) Sleep, 200 DllCall("mouse_event",uint,1,int,300,int,0,uint,0,int,0) Send, {d Down} Sleep, 100 Send, {d Up} -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,16 @@ F3:: Send, {e down} Sleep, 800 Send, {e Up} DllCall("mouse_event",uint,1,int,-1870,int,0,uint,0,int,0) Sleep, 200 DllCall("mouse_event",uint,1,int,1870,int,0,uint,0,int,0) Send, {d Down} Sleep, 100 Send, {d Up} Sleep, 100 Send, {a Down} Sleep, 100 Send, {a Up} } } -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 1 addition and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,17 +15,7 @@ F3:: pBitmap := Gdip_BitmapFromScreen("1243|971|37|21") pWhite := simpleColorCheck(pBitmap, 37, 21) Gdip_DisposeImage(pBitmap) if (pWhite >= 0.15) Break } Send, {e down} -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ F3:: pBitmap := Gdip_BitmapFromScreen("1243|971|37|21") pWhite := simpleColorCheck(pBitmap, 37, 21) Gdip_DisposeImage(pBitmap) if (pWhite >= 0.18) Break } Send, {e down} -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ SendMode Input SetWorkingDir, %A_ScriptDir% MsgBox, ***READ BEFORE USING***`nYou must have a 1440p screen for this to work. Make sure you are on 7 brightness, chromatic abberation is off, and hud opacity is max. Make sure you have interact bound to "E". Press F3 to start and F4 to stop. Does NOT work on Nessus. pToken := Gdip_Startup() -
A2TC-YT revised this gist
May 24, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ SendMode Input SetWorkingDir, %A_ScriptDir% MsgBox, ***READ BEFORE USING***`nYou must have a 1440p screen for this to work. Make sure you are on 7 brightness, chromatic abberation is off, and hud opacity is max. Press F3 to start and F4 to stop. Does NOT work on Nessus. pToken := Gdip_Startup() -
A2TC-YT created this gist
May 24, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ #SingleInstance, Force SendMode Input SetWorkingDir, %A_ScriptDir% MsgBox, ***READ BEFORE USING***`nYou must have a 1440p screen for this to work. Make sure you are on 7 brightness, chromatic abberation is off, and hud opacity is max. Press F3 to start and F4 to stop. pToken := Gdip_Startup() F3:: { Loop, { loop, { pBitmap := Gdip_BitmapFromScreen("1243|971|37|21") pWhite := simpleColorCheck(pBitmap, 37, 21) Gdip_DisposeImage(pBitmap) if (pWhite >= 0.25) Break } Send, e Sleep, 300 loop, { pBitmap := Gdip_BitmapFromScreen("1243|971|37|21") pWhite := simpleColorCheck(pBitmap, 37, 21) Gdip_DisposeImage(pBitmap) if (pWhite >= 0.20) Break } Send, {e down} Sleep, 800 Send, {e Up} } } Return simpleColorCheck(pBitmap, w, h) { x := 0 y := 0 white := 0 total := 0 loop %h% { loop %w% { color := (Gdip_GetPixel(pBitmap, x, y) & 0x00F0F0F0) if (color == 0xF0F0F0) white += 1 total += 1 x+= 1 } x := 0 y += 1 } pWhite := white/total return pWhite } F4::Reload #Include <Gdip_all>