Lambort Posted December 2, 2006 Share Posted December 2, 2006 (edited) expandcollapse popupHotKeySet("{F2}", "start") HotKeySet("{ESC}", "exitt") While 1 Sleep(100) WEnd Func Start() WinActivate("") sleep(2000) Send("1") sleep(1000) While 1 $coord = PixelSearch( 300, 0, 1024, 700, 0xffffff, 7 ) If Not @error Then MouseClick("right", $coord[0], $coord[1], 1) Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right EndIf If @error = 1 Then Send("1") MouseClick("right", $coord[0], $coord[1], 1) Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right EndIf WEnd EndFunc Func exitt() Exit EndFunc I get the error: "Subscript used with non-Array variable" All I want to do is get it to where: If it doesn't find the pixel color "0xffffff, 7" after searching for 30 seconds Then: Send("1") MouseClick("right", $coord[0], $coord[1], 1) Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") Edited December 2, 2006 by Lambort Link to comment Share on other sites More sharing options...
Developers Jos Posted December 2, 2006 Developers Share Posted December 2, 2006 EndIf If @error = 1 ThenoÝ÷ Ø(Z¡«¢+Ù±Í Its better to test for @error rigth after the function since it reports the success or failure of the Last executed function 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 comment Share on other sites More sharing options...
Lambort Posted December 2, 2006 Author Share Posted December 2, 2006 I tried that and i get: "C:\Documents and Settings\Bran\Desktop\gamemessedup.au3 (39) : ==> Subscript used with non-Array variable.: MouseClick("right", $coord[0], $coord[1], 1) MouseClick("right", $coord^ ERROR" Link to comment Share on other sites More sharing options...
BigDod Posted December 2, 2006 Share Posted December 2, 2006 If pixel is not found then you would not have co-ordinates to use in MouseClick, hence the error. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Lambort Posted December 2, 2006 Author Share Posted December 2, 2006 If pixel is not found then you would not have co-ordinates to use in MouseClick, hence the error.Argh. is there any way that I can search for the pixel for 30 seconds and if it doesn't find it then do the next command? Link to comment Share on other sites More sharing options...
Valuater Posted December 2, 2006 Share Posted December 2, 2006 maybe... expandcollapse popupHotKeySet("{F2}", "start") HotKeySet("{ESC}", "exitt") While 1 Sleep(100) WEnd Func Start() WinActivate("") Sleep(2000) Send("1") Sleep(1000) While 1 $coord = PixelSearch(300, 0, 1024, 700, 0xffffff, 7) If Not @error Then MouseClick("right", $coord[0], $coord[1], 1) Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right Else Send("1") ;MouseClick("right", $coord[0], $coord[1], 1); you cannot use $coord here because they were not found Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right EndIf WEnd EndFunc ;==>Start Func exitt() Exit EndFunc ;==>exitt 8) Link to comment Share on other sites More sharing options...
Valuater Posted December 2, 2006 Share Posted December 2, 2006 (edited) with 30 second search loop expandcollapse popupHotKeySet("{F2}", "start") HotKeySet("{ESC}", "exitt") While 1 Sleep(100) WEnd Func Start() WinActivate("") Sleep(2000) Send("1") Sleep(1000) While 1 $begin = TimerInit() $dif = "" Do $coord = PixelSearch(300, 0, 1024, 700, 0xffffff, 7) If Not @error Then MouseClick("right", $coord[0], $coord[1], 1) Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right ExitLoop ; ?????? EndIf $dif = TimerDiff($begin) Until $dif > 30000 Send("1") ;MouseClick("right", $coord[0], $coord[1], 1); you cannot use $coord here because they were not found Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right WEnd EndFunc ;==>Start Func exitt() Exit EndFunc ;==>exitt ***** NOT TESTED 8) Edited December 2, 2006 by Valuater Link to comment Share on other sites More sharing options...
Lambort Posted December 2, 2006 Author Share Posted December 2, 2006 with 30 second search loop expandcollapse popupHotKeySet("{F2}", "start") HotKeySet("{ESC}", "exitt") While 1 Sleep(100) WEnd Func Start() WinActivate("") Sleep(2000) Send("1") Sleep(1000) While 1 $begin = TimerInit() $dif = "" Do $coord = PixelSearch(300, 0, 1024, 700, 0xffffff, 7) If Not @error Then MouseClick("right", $coord[0], $coord[1], 1) Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right ExitLoop ; ?????? EndIf $dif = TimerDiff($begin) Until $dif > 30000 Send("1") ;MouseClick("right", $coord[0], $coord[1], 1); you cannot use $coord here because they were not found Sleep(3000) MouseClick("left", 54, 257) Sleep(2000) Send("{e down}") Sleep(1000) Send("{e up}") Sleep(1000) Send("1") ;right WEnd EndFunc ;==>Start Func exitt() Exit EndFunc ;==>exitt ***** NOT TESTED 8) Heh, I never would have figured that out. Thank you so much . One more thing: ;MouseClick("right", $coord[0], $coord[1], 1); you cannot use $coord here because they were not found How could I get it to search for the pixel again? Link to comment Share on other sites More sharing options...
Valuater Posted December 2, 2006 Share Posted December 2, 2006 Welcome How could I get it to search for the pixel again? While 1 Sleep(100) Start() WEnd 8) 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