xMattx 0 Posted June 5, 2022 Share Posted June 5, 2022 Hello i have problem with my script, when i want to continue loop. After a few minutes my script is turning off, can someone help me? This script is looking for blue color in window, and when it's gone it refresh the program Global $g_bPaused = False HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d While 1 $Coord = PixelSearch ( 951, 25,1558, 43,0x2A2A2A ) If Not @error Then Send("{f5}") sleep(500) send("{f5}") sleep(500) Send("{f5}") sleep(500) Send("{f5}") sleep(500) EndIf Wend if $load=1 Then ContinueLoop EndIf $loaded=0 $countersec=0 While 1 $Coord = PixelSearch ( 951, 25,1558, 43,0x003678 ) If @error Then Send("{f5}") sleep(500) send("{f5}") sleep(500) Send("{f5}") sleep(500) Send("{f5}") EndIf Wend Func TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit EndFunc ;==>Terminate Func ShowMessage() MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndFunc ;==>ShowMessage Link to post Share on other sites
xMattx 0 Posted June 5, 2022 Author Share Posted June 5, 2022 Hello i have problem with my script, when i want to continue loop. After a few minutes my script is turning off, can someone help me? This script is looking for blue color in window, and when it's gone it refresh the program Global $g_bPaused = False HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d While 1 $Coord = PixelSearch ( 951, 25,1558, 43,0x2A2A2A ) If Not @error Then Send("{f5}") sleep(500) send("{f5}") sleep(500) Send("{f5}") sleep(500) Send("{f5}") sleep(500) EndIf Wend if $load=1 Then ContinueLoop EndIf $loaded=0 $countersec=0 While 1 $Coord = PixelSearch ( 951, 25,1558, 43,0x003678 ) If @error Then Send("{f5}") sleep(500) send("{f5}") sleep(500) Send("{f5}") sleep(500) Send("{f5}") EndIf Wend Func TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit EndFunc ;==>Terminate Func ShowMessage() MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndFunc ;==>ShowMessage Link to post Share on other sites
Musashi 738 Posted June 5, 2022 Share Posted June 5, 2022 1 hour ago, xMattx said: After a few minutes my script is turning off, can someone help me? I doubt, that the script you provided will even starts . #include <MsgBoxConstants.au3> is missing. No value has been assigned to $load yet. In addition, the use of ContinueLoop throws the error : 'ContinueLoop' not allowed outside loop. If $load = 1 Then ContinueLoop EndIf $loaded and $countersec are not used anywhere. Please provide a runnable script first, so that one can be of further help. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to post Share on other sites
xMattx 0 Posted June 5, 2022 Author Share Posted June 5, 2022 HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d While 1 $Coord = PixelSearch ( 951, 25,1558, 43,0x2A2A2A ) If Not @error Then sleep(1000) Send("{f5}") sleep(1000) EndIf Wend While 1 $Coord = PixelSearch ( 951, 25,1558, 43,0x003678 ) If @error Then sleep(1000) Send("{f5}") sleep(1000) EndIf Wend Func TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit EndFunc ;==>Terminate Func ShowMessage() MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndFunc ;==>ShowMessage Link to post Share on other sites
xMattx 0 Posted June 5, 2022 Author Share Posted June 5, 2022 2 hours ago, Musashi said: I doubt, that the script you provided will even starts . #include <MsgBoxConstants.au3> is missing. No value has been assigned to $load yet. In addition, the use of ContinueLoop throws the error : 'ContinueLoop' not allowed outside loop. If $load = 1 Then ContinueLoop EndIf $loaded and $countersec are not used anywhere. Please provide a runnable script first, so that one can be of further help. Okay this one works Link to post Share on other sites
Developers Jos 2,849 Posted June 5, 2022 Developers Share Posted June 5, 2022 (edited) Moved to the appropriate forum.... And merged. Hope you will pay proper attention next time and not crosspost. ...and read our forum rules as this is likely game related!? Moderation Team Edited June 5, 2022 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to post Share on other sites
xMattx 0 Posted June 5, 2022 Author Share Posted June 5, 2022 No this is not game, it's just browser site Link to post Share on other sites
xMattx 0 Posted June 6, 2022 Author Share Posted June 6, 2022 Anyone know how to fix this problem ? Link to post Share on other sites
Musashi 738 Posted June 6, 2022 Share Posted June 6, 2022 On 6/5/2022 at 7:15 PM, xMattx said: Okay, this one works It works syntactically now (since you just omitted the problems), but not functionally . I am still not quite certain, what you want to accomplish. On 6/5/2022 at 2:34 PM, xMattx said: i have a problem with my script, when i want to continue loop. After a few minutes my script is turning off, can someone help me? This script is looking for blue color in window, and when it's gone it refresh the program Why do you run a pixel search on the color 0x2A2A2A (which is a dark gray)? (Aside : PixelSearch and Send are not very reliable techniques, but I'll leave it as it is.) Here is a script that looks for the color 0x003678 (your requested blue). If the color is not found, a refresh will occur. ContinueLoop will not be necessary. expandcollapse popup#include <MsgBoxConstants.au3> #include <Timers.au3> Global $g_bPaused = False, $Coord, $hColor Global $hStarttime = _Timer_Init() ; *** just an info HotKeySet("{PAUSE}", _TogglePause) HotKeySet("{ESC}", _Terminate) HotKeySet("+!d", _ShowMessage) ; Shift-Alt-d $hColor = "0x003678" ; the blue color you are looking for in a window While True $Coord = PixelSearch(951, 25 , 1558, 43, $hColor) If Not @error Then ToolTip("Time : " & StringFormat("%.2f", _Timer_Diff($hStarttime) / 1000) & " sec. Color " & $hColor & " found", 0, 0) Sleep(500) Else ToolTip("Time : " & StringFormat("%.2f", _Timer_Diff($hStarttime) / 1000) & " sec. Color " & $hColor & " not found -> refresh", 0, 0) ; do a refresh with : Send("{f5}") Sleep(500) EndIf WEnd ; -------------- Functions ----------------------------------------- Func _TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>_TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate Func _ShowMessage() MsgBox($MB_SYSTEMMODAL, "", "This is a message.") EndFunc ;==>_ShowMessage "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to post Share on other sites
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