Jump to content

GUI becomes unusable


 Share

Recommended Posts

Func antiAFKnow()
    If WinExists("World of Warcraft") == 1 Then
        HotKeySet("{PAUSE}")
        HotKeySet("{PAUSE}", "TogglePause")
            TrayTip("Leoj's WoW Tool", "Now running the anti AFK script.", 5, 0) 
            Sleep(GUICtrlRead($UI_Load_Wait)*1000)
            $p = 0
            $pause = 0
            While $p <= GUICtrlRead($UI_Jump_Times)
                If $pause = 1 Then
                    Exitloop 3
                Else
                Sleep(GUICtrlRead($UI_Jump_Sleep)*1000)
                ;Sleep(Random(120000,240000))     ;sleep for 2-4 minutes
                TrayTip("Leoj's WoW Tool", "Anti AFK has jumped " & $p + 1 & " times", 20, 0)
                ControlSend("World of Warcraft", "", "", "{SPACE}")
                EndIf
            $p = $p + 1
            WEnd
        TrayTip("Leoj's WoW Tool", "Anti AFK has completed.", 5, 0)
    Else
        MsgBox(0, "Error", "World of Warcraft is not running.")
    EndIf
EndFunc

Func TogglePause()
    TrayTip("Leoj's WoW Tool", "Anti AFK stopped and number of jumps reset.", 0)
    HotKeySet("{PAUSE}")
    HotKeySet("{PAUSE}", "antiAFKnow")
    $pause = 1
    While 1
        sleep(100)
    WEnd
EndFunc

please help.... how do i exit the first function all together (not pause) w/ pause button?

Link to comment
Share on other sites

Will a crude example do? :) :

#include <GUIConstants.au3>

HotKeySet("!{ESC}", "EscapeFuntion") ; Alt + ESC

GUICreate("Test quit function")
$Button = GUICtrlCreateButton("Start", 20, 20, 70, 30)
GUISetState()

$escape = 0

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Button 
            Annoy()
            $escape = 0
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect       
WEnd    
        

Func Annoy()
    While 1
        If $escape = 1 Then Return ''
        MsgBox(0,"","Annoying Huh.." & @LF & "Press Alt + ESC to exit this annoying function")
    WEnd
EndFunc

Func EscapeFuntion()
    $escape = 1
EndFunc

Cheers

Link to comment
Share on other sites

As I don't have WoW installed to test it I can't really say, but does your pause function work?

If so then try this:

Func antiAFKnow()
    If WinExists("World of Warcraft") == 1 Then
        HotKeySet("{PAUSE}")
        HotKeySet("{PAUSE}", "TogglePause")
            TrayTip("Leoj's WoW Tool", "Now running the anti AFK script.", 5, 0)
            Sleep(GUICtrlRead($UI_Load_Wait)*1000)
            $p = 0
            $pause = 0
            While $p <= GUICtrlRead($UI_Jump_Times)
                If $pause = 1 Then Return '' ; <--- Try return from pause
                Sleep(GUICtrlRead($UI_Jump_Sleep)*1000)
                ;Sleep(Random(120000,240000))     ;sleep for 2-4 minutes
                TrayTip("Leoj's WoW Tool", "Anti AFK has jumped " & $p + 1 & " times", 20, 0)
                ControlSend("World of Warcraft", "", "", "{SPACE}")
                EndIf
            $p = $p + 1
            WEnd
        TrayTip("Leoj's WoW Tool", "Anti AFK has completed.", 5, 0)
    Else
        MsgBox(0, "Error", "World of Warcraft is not running.")
    EndIf
EndFunc
Edited by smashly
Link to comment
Share on other sites

HotKeySet("{F11}", "stopJump")
$stop = 0

Func antiAFKnow()
    While 1
        If $stop = 1 Then Return ''
            If WinExists("World of Warcraft") == 1 Then
                    TrayTip("Leoj's WoW Tool", "Now running the anti AFK script.", 5, 0) 
                    Sleep(GUICtrlRead($UI_Load_Wait)*1000)
                    $p = 0
                    While $p <= GUICtrlRead($UI_Jump_Times)
                        If $stop = 1 Then Return ''
                        Sleep(GUICtrlRead($UI_Jump_Sleep)*1000)
                        ;Sleep(Random(120000,240000))     ;sleep for 2-4 minutes
                        TrayTip("Leoj's WoW Tool", "Anti AFK has jumped " & $p + 1 & " times", 20, 0)
                        ControlSend("World of Warcraft", "", "", "{SPACE}")
                    $p = $p + 1
                    WEnd
                TrayTip("Leoj's WoW Tool", "Anti AFK has completed.", 5, 0)
            Else
                MsgBox(0, "Error", "World of Warcraft is not running.")
            EndIf
    WEnd
EndFunc

Func stopJump()
    $stop = 1
EndFuncoÝ÷ Ù«­¢+ظ¸¸¸¸¸¸¸¹±±±¸¸¸¸¸¸¸¸¸¸(¸¸¸¸¸¸¸¸¸¸¸¸¸¹±±±¸¸¸¸¸¸¸¸¸¸¸¸(¸¸¸¸¸¸¸¸¸¸¸¸¸¸¸¹±±±¸¸¸¸¸¸(%
ÍÀÌØíµÍôÀÌØí    ÕÑѽ¸($$%¹Ñ¥-¹½Ü ¤($$$ÀÌØíÍѽÀôÀ(%
ͱÍ($$ìììì)¹M±Ð)]¹)á¥

...It worked!!! I just had to work around my double "while...Wend" loops. Thanks a lot, I hope you feel really good about yourself when you go to bed tonight.

Thanks again, ~Leoj

Link to comment
Share on other sites

Hrm, a new problem arises: if there is a long sleep time then the script doesn't stop until after the sleep time... which can eliminate the stop-script button all together >.<

--Could I possibly change the wait time to "0" (when you press the key that is bound to stopJumping) so it skips over that Sleep() and ends the function?

Edited by Leoj
Link to comment
Share on other sites

Your welcome :)

As far as I'm aware the sleep function does exactly that , it makes the script sleep for the period of time so I can't see you stopping a sleep until it's finished unless you exit the script. ( I could be wrong)

Maybe do some math with the sleep so you can check while sleeping if anything is changed.

eg:

If the sleep time is 1000 then divide it into smaller periods of time (maybe 5 x 200) and run checks for something changed in between periods, if something has changed then Return. If nothing has changed then continue on to the next period.

Do this until the 1000 is reached.

I'm only thinking out aloud when I say this and I don't think it's a great solution, but maybe it's a work around to waiting for a long sleep to finish.

Good luck

Cheers

Edit , looks like you already found the solution while I was typing..lol

Edited by smashly
Link to comment
Share on other sites

Haha, we were thinking on the same level =).

I figured that out just by thinking about it... its really rewarding when that happens! But thanks for thinking about it too (and at same time, haha).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...