SpaceGT / Anti-AFK

A lightweight script to deal with those pesky AFK timers
GNU General Public License v3.0
38 stars 19 forks source link

Error on roblox #15

Closed pokecosimo closed 9 months ago

pokecosimo commented 9 months ago

Hello, i use this anti afk for roblox and gives me this error 281533962-0c130d58-c2ce-42ab-8070-5d6987bb066a

SpaceGT commented 9 months ago

Interesting. This is the second time someone has encountered this issue. I will try and debug it; does it happen often?

pokecosimo commented 9 months ago

Interesting. This is the second time someone has encountered this issue. I will try and debug it; does it happen often?

yeah. everytime

pokecosimo commented 9 months ago

Interesting. This is the second time someone has encountered this issue. I will try and debug it; does it happen often?

did u fix it?

towermom9 commented 9 months ago

yo I got the same bug after I updated windows. I think it's somehow related?

towermom9 commented 9 months ago

@pokecosimo have you tried running it with admin privileges? (right click then run as administrator)

pokecosimo commented 9 months ago

@pokecosimo have you tried running it with admin privileges? (right click then run as administrator)

yes

SpaceGT commented 9 months ago

Hello there o/ I wasn't able to reproduce this on my computer. I'll try updating windows, but that tends to take a while.

SpaceGT commented 9 months ago

Well that didn't work :(

It's clear the system the script is running on definitely has a role in whether this issue arises. Perhaps slower computers are not able to activate the window in time? We can get around this by using WinWaitActive() after a window is activated.

Can one of you please test if this fixes it?

Here's the modified function:

resetTimer(targetWindow, resetAction, DenyInput)
{
    if (!WinExist("A") || (WinGetClass("A") = "WorkerW" || WinGetClass("A") = "Progman"))
    {
        WinActivate("ahk_id " targetWindow)
        WinWaitActive("ahk_id " targetWindow)
    }

    if (WinActive("ahk_id " targetWindow))
    {
        resetAction()
        return
    }

    if (DenyInput && A_IsAdmin)
        BlockInput("On")

    oldWindow := WinGetID("A")

    WinSetTransparent(0, "ahk_id " targetWindow)
    WinActivate("ahk_id " targetWindow)
    WinWaitActive("ahk_id " targetWindow)

    resetAction()

    WinMoveBottom("ahk_id " targetWindow)
    WinSetTransparent("OFF", "ahk_id " targetWindow)

    WinActivate("ahk_id " oldWindow)
    WinWaitActive("ahk_id " oldWindow)

    if (DenyInput && A_IsAdmin)
        BlockInput("Off")
}
towermom9 commented 9 months ago

yeah I think it's related to the system. because I had the problem with my Intel gen 4 laptop. but using it on my gen 12 laptop it runs fine.

pokecosimo commented 9 months ago

Well that didn't work :(

It's clear the system the script is running on definitely has a role in whether this issue arises. Perhaps slower computers are not able to activate the window in time? We can get around this by using WinWaitActive() after a window is activated.

Can one of you please test if this fixes it?

Here's the modified function:

resetTimer(targetWindow, resetAction, DenyInput)
{
    if (!WinExist("A") || (WinGetClass("A") = "WorkerW" || WinGetClass("A") = "Progman"))
    {
        WinActivate("ahk_id " targetWindow)
        WinWaitActive("ahk_id " targetWindow)
    }

    if (WinActive("ahk_id " targetWindow))
    {
        resetAction()
        return
    }

    if (DenyInput && A_IsAdmin)
        BlockInput("On")

    oldWindow := WinGetID("A")

    WinSetTransparent(0, "ahk_id " targetWindow)
    WinActivate("ahk_id " targetWindow)
    WinWaitActive("ahk_id " targetWindow)

    resetAction()

    WinMoveBottom("ahk_id " targetWindow)
    WinSetTransparent("OFF", "ahk_id " targetWindow)

    WinActivate("ahk_id " oldWindow)
    WinWaitActive("ahk_id " oldWindow)

    if (DenyInput && A_IsAdmin)
        BlockInput("Off")
}

im testing it

pokecosimo commented 9 months ago

Well that didn't work :(

It's clear the system the script is running on definitely has a role in whether this issue arises. Perhaps slower computers are not able to activate the window in time? We can get around this by using WinWaitActive() after a window is activated.

Can one of you please test if this fixes it?

Here's the modified function:

resetTimer(targetWindow, resetAction, DenyInput)
{
    if (!WinExist("A") || (WinGetClass("A") = "WorkerW" || WinGetClass("A") = "Progman"))
    {
        WinActivate("ahk_id " targetWindow)
        WinWaitActive("ahk_id " targetWindow)
    }

    if (WinActive("ahk_id " targetWindow))
    {
        resetAction()
        return
    }

    if (DenyInput && A_IsAdmin)
        BlockInput("On")

    oldWindow := WinGetID("A")

    WinSetTransparent(0, "ahk_id " targetWindow)
    WinActivate("ahk_id " targetWindow)
    WinWaitActive("ahk_id " targetWindow)

    resetAction()

    WinMoveBottom("ahk_id " targetWindow)
    WinSetTransparent("OFF", "ahk_id " targetWindow)

    WinActivate("ahk_id " oldWindow)
    WinWaitActive("ahk_id " oldWindow)

    if (DenyInput && A_IsAdmin)
        BlockInput("Off")
}

it seams working

SpaceGT commented 9 months ago

Glad to hear it! I'll push out the fix then :)

SpaceGT commented 9 months ago

This should now be fixed in f8afd99e007788f21e4d6a927005a00fb01d1141