From bf7270a1dc7fae38d41e25919253b50ebb696191 Mon Sep 17 00:00:00 2001 From: Nathaniel M Date: Thu, 3 Nov 2022 16:50:32 -0700 Subject: [PATCH 1/5] Fix windows detection - Change Title Match Mode to be 3 which is exact match. --- AFB.ahk | 1 + 1 file changed, 1 insertion(+) diff --git a/AFB.ahk b/AFB.ahk index d2a3454..0332925 100644 --- a/AFB.ahk +++ b/AFB.ahk @@ -1,5 +1,6 @@ ; AHK v2 #SingleInstance Force +#SetTitleMatchMode 3 /* constants From 12b94cd45bbaf53167af7f14859ea3e3951b21a5 Mon Sep 17 00:00:00 2001 From: Nathaniel M Date: Thu, 3 Nov 2022 16:54:28 -0700 Subject: [PATCH 2/5] Fixed Error with SetTitleMatchMode --- AFB.ahk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFB.ahk b/AFB.ahk index 0332925..f49e686 100644 --- a/AFB.ahk +++ b/AFB.ahk @@ -1,6 +1,6 @@ ; AHK v2 #SingleInstance Force -#SetTitleMatchMode 3 +SetTitleMatchMode 3 /* constants From c97d3dd3aeda39b6aa37e27ad1d4ac011a114c09 Mon Sep 17 00:00:00 2001 From: Nathaniel M Date: Thu, 3 Nov 2022 17:07:53 -0700 Subject: [PATCH 3/5] Improvements to the Reconnect. This seems to work 100% of the time on 1920x1080, a smaller window seems to work 2nd try. --- AFB.ahk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AFB.ahk b/AFB.ahk index f49e686..2bf80f0 100644 --- a/AFB.ahk +++ b/AFB.ahk @@ -86,6 +86,7 @@ Reconnect(winWidth, winHeight) { try { for (searchImage in RECONNECT_IMG_SEARCH_ARRAY) { if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) { + MouseMove(foundX - 20, FoundY - 20, 0) ClickImageMidPoint(searchImage, foundX, foundY) return 1 } @@ -127,9 +128,8 @@ ClickImageMidPoint(imageFile, xOffset, yOffset){ clickX := imageMidPoint[1] + xOffset clickY := imageMidPoint[2] + yOffset - ; ! Clicks seems to be flakey, this is why using two Click() instead of the 3rd parameter - Click(clickX, clickY) - Sleep(350) + MouseMove(clickX, clickY, 25) + Sleep(250) Click(clickX, clickY) } From 0c2095e4f086283651d724d2a1998a18e634f745 Mon Sep 17 00:00:00 2001 From: Nathaniel M Date: Fri, 4 Nov 2022 10:56:09 -0700 Subject: [PATCH 4/5] Reconnection working 100% on all screens. - Closes #16 --- AFB.ahk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/AFB.ahk b/AFB.ahk index 2bf80f0..3379f3b 100644 --- a/AFB.ahk +++ b/AFB.ahk @@ -86,7 +86,7 @@ Reconnect(winWidth, winHeight) { try { for (searchImage in RECONNECT_IMG_SEARCH_ARRAY) { if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) { - MouseMove(foundX - 20, FoundY - 20, 0) + MouseMove(foundX - 100, FoundY - 100, 0) ClickImageMidPoint(searchImage, foundX, foundY) return 1 } @@ -128,8 +128,9 @@ ClickImageMidPoint(imageFile, xOffset, yOffset){ clickX := imageMidPoint[1] + xOffset clickY := imageMidPoint[2] + yOffset - MouseMove(clickX, clickY, 25) - Sleep(250) + SendMode("Event") + MouseMove(clickX, clickY, 10) + SendMode("Input") Click(clickX, clickY) } From d7134e6e350c8f4720787cd47460be6ea14e7856 Mon Sep 17 00:00:00 2001 From: Nathaniel M Date: Fri, 4 Nov 2022 11:21:44 -0700 Subject: [PATCH 5/5] Requested Changes - Added a comment block explaining why it's done this way and why we change SendMode. --- AFB.ahk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/AFB.ahk b/AFB.ahk index 3379f3b..e2f92c7 100644 --- a/AFB.ahk +++ b/AFB.ahk @@ -86,7 +86,6 @@ Reconnect(winWidth, winHeight) { try { for (searchImage in RECONNECT_IMG_SEARCH_ARRAY) { if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) { - MouseMove(foundX - 100, FoundY - 100, 0) ClickImageMidPoint(searchImage, foundX, foundY) return 1 } @@ -128,6 +127,15 @@ ClickImageMidPoint(imageFile, xOffset, yOffset){ clickX := imageMidPoint[1] + xOffset clickY := imageMidPoint[2] + yOffset + /* + Teleports Mouse to the corner of the button, offset -100pxs to get further away from the button. + Then setting SendMode to Event allows us to "Side" the mouse onto the Reconnect button, therefore creating a hover event. + Then resetting the SendMode and in the end, clicking the button. + + The reason we "Slide" onto the Reconnect Button is because Roblox refuses to detect a MouseClick if the Mouse snapped onto the button. + This code here fixes https://github.com/UpDownLeftDie/AwayFromBlox/issues/16 + */ + MouseMove(xOffset - 100, yOffset - 100, 0) SendMode("Event") MouseMove(clickX, clickY, 10) SendMode("Input")