Sign in to follow this  
Followers 0
Xoenix

How to stop a function.

3 posts in this topic

This is my code so far.

#include <GuiConstants.au3>

GuiCreate("Auto Clicker", 348, 223, 366,266)

$n = GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 366,266)

GuiCtrlSetState($n, $GUI_DISABLE)

$Button1 = GuiCtrlCreateButton("Auto Clicker On", 80, 72, 120, 33)

$Button2 = GuiCtrlCreateButton("Auto Clicker Off", 80, 112, 120, 33)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button1 ;On Button

Clicker()

Case $msg = $Button2 ;Off Button

Exit

Case Else

;;;

EndSelect

WEnd

Exit

;Clicker

Func Clicker()

While 1

WinWaitActive("MapleStory")

MouseClick ("left")

WEnd

EndFunc

As you can see its an Auto Clicker, very simple. The only problem im have is that after I start it, pressing the off button doesnt stop it, and i need to Ctrl Alt Delete to exit, quite annoying. So a lil help would be awesome ;)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try something like HotKeySet:

#include <GuiConstants.au3>
HotKeySet("{Esc}", "_Stop")

Global $Clicking = 0

GUICreate("Auto Clicker", 348, 223, 366, 266)
$n = GUICtrlCreatePic(@SystemDir & "\oobe\images\wpakey.jpg", 0, 0, 366, 266)
GUICtrlSetState($n, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Auto Clicker On", 80, 72, 120, 33)
$Button2 = GUICtrlCreateButton("Auto Clicker Off", 80, 112, 120, 33)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1;On Button
            $Clicking = 1
            Clicker()
        Case $msg = $Button2;Off Button
            $Clicking = 0
        Case Else
        ;;;
    EndSelect
WEnd
Exit


;Clicker
Func Clicker()
    While $Clicking
        WinWaitActive("MapleStory")
        MouseClick("left")
    WEnd
EndFunc  ;==>Clicker

Func _Stop()
    $Clicking = 0
EndFunc  ;==>_Stop
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanks, worked perfectly ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0