onestcoder Posted February 14, 2006 Posted February 14, 2006 I keep haveing this problem with many of my scripts. For example I create a button on my gui to run a pause funtion. but when I pause it the button no longer works. Same goes for another script of mine were while the funtions are activated I can nolonger use the gui controls. What I'm I overlooking???? Here is a short throw together script to show you my problem. expandcollapse popup#include <GUIConstants.au3> $gui = GUICreate("Auto Hunter", 100, 33, 0, 0, -1, $WS_EX_TOPMOST) Global $Paused $x = Int(1 + Random(20)) $button_1 = GUICtrlCreateButton(">>>", 5, 4, 25, 25) GUICtrlSetState($button_1, $GUI_FOCUS) $n2 = GUICtrlCreateButton("[X]", 65, 4, 25, 25) $p2 = GUICtrlCreateButton("||", 35, 4, 25, 25) GUISetState() Do $msg = GUIGetMsg() If $msg = $button_1 Then Call('hunt') If @error Then ContinueLoop EndIf If $msg = $n2 Then Exit EndIf If $msg = $p2 Then Call("TogglePause") EndIf Until $msg = $GUI_EVENT_CLOSE ; Hunt function Func hunt() While 1 Sleep(5000) Send("{NUMPAD8 DOWN}");starts your character running Send("{NUMPAD0 $x}");cycles through $x npc's Sleep(500) Send("{ENTER}") Sleep(500) Send("{ENTER}") Sleep(10000) Send("{NUMPAD8 UP}") Sleep(30000) WEnd EndFunc ;==>hunt ; Pause function Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc ;==>TogglePause ; Exit function Func Terminate() Exit 0 EndFunc ;==>Terminate Need a website: http://www.iconixmarketing.com
pecloe Posted February 14, 2006 Posted February 14, 2006 before i look any closer why are you using "call" ?
GaryFrost Posted February 14, 2006 Posted February 14, 2006 (edited) expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $Paused = False, $hunting = False $gui = GUICreate("Auto Hunter", 100, 33, 0, 0, -1, $WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") Global $Paused $x = Int(1 + Random(20)) $button_1 = GUICtrlCreateButton(">>>", 5, 4, 25, 25) GUICtrlSetOnEvent($button_1, "hunt") GUICtrlSetState($button_1, $GUI_FOCUS) $n2 = GUICtrlCreateButton("[X]", 65, 4, 25, 25) GUICtrlSetOnEvent($n2, "Terminate") $p2 = GUICtrlCreateButton("||", 35, 4, 25, 25) GUICtrlSetOnEvent($p2, "TogglePause") GUISetState() While 1 Sleep(10) While $hunting = True ToolTip("hunting",0,0) Sleep(5000) Send("{NUMPAD8 DOWN}");starts your character running Send("{NUMPAD0 $x}");cycles through $x npc's Sleep(500) Send("{ENTER}") Sleep(500) Send("{ENTER}") Sleep(10000) Send("{NUMPAD8 UP}") Sleep(30000) WEnd WEnd ; Hunt function Func hunt() If $hunting = False And $Paused = True Then TogglePause() Else $hunting = True EndIf EndFunc ;==>hunt ; Pause function Func TogglePause() $Paused = Not $Paused $hunting = Not $hunting If $Paused = False Then ToolTip("") ElseIf $Paused = True Then Sleep(100) ToolTip('Script is "Paused"', 0, 0) EndIf EndFunc ;==>TogglePause ; Exit function Func Terminate() Exit 0 EndFunc ;==>Terminate Edited February 14, 2006 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.
jvanegmond Posted February 14, 2006 Posted February 14, 2006 I had the same problem.. but then i realised i didn't need this at all.. So, no solution came out eventually, but i just wanted to let you know it's not just you github.com/jvanegmond
pecloe Posted February 14, 2006 Posted February 14, 2006 (edited) Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc;==>TogglePause this is meant to be used with a hotkey, the script is getting stuck in the while/wend loop edit; nvm gafrost fixed the wholt thing before i could even read the original code! boy have i got a lot to learn! Edited February 14, 2006 by pecloe
onestcoder Posted February 15, 2006 Author Posted February 15, 2006 Global $Paused = False, $hunting = False Its not working. I get an erro Need a website: http://www.iconixmarketing.com
GaryFrost Posted February 15, 2006 Posted February 15, 2006 Global $Paused = False, $hunting = FalseIts not working. I get an erro replace False with 0replace True with 1 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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