diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e24097c..f054d23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,11 @@ jobs: with: in: AFB build_dir: build + - name: Easy Zip Files + uses: vimtor/action-zip@v1 + with: + files: AFB.ahk plugins/ + dest: build/AFB.zip - name: Release uses: softprops/action-gh-release@v1 @@ -32,6 +37,6 @@ jobs: files: | build/AFB_64-bit.exe build/AFB_32-bit.exe - AFB.ahk + build/AFB.zip env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/AFB.ahk b/AFB.ahk index 1ecbceb..f0194ec 100644 --- a/AFB.ahk +++ b/AFB.ahk @@ -7,24 +7,40 @@ ONE_MIN := 1000 * 60 THREE_MINS := 3 * ONE_MIN FIVE_MINS := 5 * ONE_MIN SIXTEEN_MINS := 15 * ONE_MIN +DATA_DIR := A_ScriptDir . "\data" +RECONNECT_BUTTON_IMG := DATA_DIR . "\reconnect-button.png" +RECONNECT_TEXT_IMG := DATA_DIR . "\reconnect-text.png" +RECONNECT_IMG_SEARCH_ARRAY := [RECONNECT_BUTTON_IMG, RECONNECT_TEXT_IMG] /* globals */ IsRunning := false +DirCreate(DATA_DIR) +FileInstall(RECONNECT_BUTTON_IMG, RECONNECT_BUTTON_IMG, 1) +FileInstall(RECONNECT_TEXT_IMG, RECONNECT_TEXT_IMG, 1) #MaxThreadsPerHotkey 2 F1:: { global IsRunning := !IsRunning While (IsRunning) { - if WinExist("Roblox") { - WinActivate ; defaults to WinExist - WinGetPos(&winX, &winY, &winWidth, &winHeight) ; defaults to WinExist + lastID := WinGetID("A") + robloxID := WinExist("Roblox") + if (robloxID) { + ; BEGIN WORK + BlockInput(True) + + WinActivate(robloxID) + WinGetPos(&winX, &winY, &winWidth, &winHeight, robloxID) Reconnect(winWidth, winHeight) BreakAFK() + WinActivate(lastID) + BlockInput(False) + ; END OF WORK + antiKickInterval := GetIntervalMins() sleep(antiKickInterval) } else { @@ -48,17 +64,11 @@ BreakAFK() { */ Reconnect(winWidth, winHeight) { try { - searchImage := "plugins/roblox/reconnect-button.png" - if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) { - ClickImageMidPoint(searchImage, foundX, foundY) - return 1 - } - - ; try with smaller image, this seems to be less reliable - searchImage := "plugins/roblox/reconnect-text.png" - if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) { - ClickImageMidPoint(searchImage, foundX, foundY) - return 1 + for (searchImage in RECONNECT_IMG_SEARCH_ARRAY) { + if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) { + ClickImageMidPoint(searchImage, foundX, foundY) + return 1 + } } } catch as exc { MsgBox "Something went wrong when trying to check for reconnect button:`n" exc.Message diff --git a/contributing.md b/CONTRIBUTING.md similarity index 100% rename from contributing.md rename to CONTRIBUTING.md diff --git a/readme.md b/README.md similarity index 88% rename from readme.md rename to README.md index ee176e4..cdc23d7 100644 --- a/readme.md +++ b/README.md @@ -6,6 +6,7 @@ AutoHotkey scripts to specifically to help you when you're *Away From (Ro)Blox* 1. [Download latest release](/releases/latest) 2. Double-click to run + 1. Optionally run as Administrator for input-blocking 3. Press `F1` to activate ## How to use (.ahk file) @@ -13,6 +14,7 @@ AutoHotkey scripts to specifically to help you when you're *Away From (Ro)Blox* 1. **Install [AutoHotkey v2](https://www.autohotkey.com/download/ahk-v2.exe)** Beta or higher 2. [Download latest release](/releases/latest) 3. Double-click to run + 1. Optionally run as Administrator for input-blocking 4. Press `F1` to activate ## TODO @@ -24,11 +26,10 @@ AutoHotkey scripts to specifically to help you when you're *Away From (Ro)Blox* * Eventually remove custom `ahk2exe` github action, once its been updated to support AHK v2 (watch [GitHub-Action-Ahk2Exe](https://github.com/nekocodeX/GitHub-Action-Ahk2Exe) repo) * Modularity * Support multiple games with unique AFK conditions and loops -* Swap back to last active window after executing anti-kick * Startup config * Options to select which modules/game actions to load * Option for what the "AFK break action" is (default: space key) ## Contributing -See [contributing.md](contributing.md) +See [CONTRIBUTING.md](CONTRIBUTING.md) diff --git a/plugins/roblox/reconnect-button.png b/data/reconnect-button.png similarity index 100% rename from plugins/roblox/reconnect-button.png rename to data/reconnect-button.png diff --git a/plugins/roblox/reconnect-text.png b/data/reconnect-text.png similarity index 100% rename from plugins/roblox/reconnect-text.png rename to data/reconnect-text.png