sebbe133 Posted February 7, 2009 Share Posted February 7, 2009 Hi. I cannot get the program to stop pressing the buttons when the function button1 is activated. I've looked around in the doc.. expandcollapse popupGuiCreate("miniAFK",200,220,531,473) Global $c=0 $button1=GuiCtrlCreateButton("AFK",44,16,113,55) $button2=GuiCtrlCreateButton("I'm back",44,78,113,55) $button3=GuiCtrlCreateButton("Exit",44,145,113,55) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit If $msg=$button1 Then button1() If $msg=$button2 Then button2() If $msg=$button3 Then button3() Wend Func button1() $c=1 ToolTip("miniAFK initiated.",0,0) while $c=1 ToolTip("Waiting for timer..",0,0) $r=Random(120000, 360000, 1) sleep($r) ToolTip("Jumping!",0,0) ControlSend("World of Warcraft","","","{SPACE}") WEnd EndFunc Func button2() $c=0 ToolTip("The bot is now off. Press ESC to exit.",0,0) hotkeyset("{ESC}", "button3") Sleep(3000) ToolTip("",0,0) hotkeyset("{ESC}", "button3") EndFunc Func button3() Exit EndFunc Link to comment Share on other sites More sharing options...
martin Posted February 7, 2009 Share Posted February 7, 2009 Hi. I cannot get the program to stop pressing the buttons when the function button1 is activated. I've looked around in the doc.. expandcollapse popupGuiCreate("miniAFK",200,220,531,473) Global $c=0 $button1=GuiCtrlCreateButton("AFK",44,16,113,55) $button2=GuiCtrlCreateButton("I'm back",44,78,113,55) $button3=GuiCtrlCreateButton("Exit",44,145,113,55) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit If $msg=$button1 Then button1() If $msg=$button2 Then button2() If $msg=$button3 Then button3() Wend Func button1() $c=1 ToolTip("miniAFK initiated.",0,0) while $c=1 ToolTip("Waiting for timer..",0,0) $r=Random(120000, 360000, 1) sleep($r) ToolTip("Jumping!",0,0) ControlSend("World of Warcraft","","","{SPACE}") WEnd EndFunc Func button2() $c=0 ToolTip("The bot is now off. Press ESC to exit.",0,0) hotkeyset("{ESC}", "button3") Sleep(3000) ToolTip("",0,0) hotkeyset("{ESC}", "button3") EndFunc Func button3() Exit EndFuncWhen you call button1 it will stay in that function untill $c is changed to 0 (As you know). But $c can't get changed becase it only gets changed when buttin2 is called, and that can't be called because it is called from the while loop waiting for buttons, but the script isn't executing the while loop it's in the button1 function. Does that make sense? If it does then the next thing is to decide how to get round it, but I think it's important that you understand why your script isn't doing what you expected first. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
NerdFencer Posted February 7, 2009 Share Posted February 7, 2009 try... While $c==1 Not While $c=1 _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
sebbe133 Posted February 7, 2009 Author Share Posted February 7, 2009 Nope, not working NerdFencer. Kk, gonna go figure then martin Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now