Taumantis Posted December 5, 2011 Share Posted December 5, 2011 (edited) HotKeySet("^!x", "MyExit") Func MyExit() Exit EndFunc Opt("MouseCoordMode",1) Do Sleep(100) MouseMove(1097,760) MouseClick("left") Sleep(100) Do $i = PixelGetColor(1015,760) Until $i = 10846764 MouseClick("left") Until @error i have sometning like this, in place 1015,760 is other color than this then do/until dont want to break... i know some c++ and for me it is ok... what i am doing wrong? Edited December 5, 2011 by Taumantis Link to comment Share on other sites More sharing options...
jchd Posted December 5, 2011 Share Posted December 5, 2011 (edited) First @error will get set to success since MouseClick isn't likely to fail. Then what instruction do you expect to break the inner Do loop, since you yourself say the color picked will never equal the constant you use? In AutoIt like C--, C, C++ or any other language, Do <whatever> Until <condition never met> loops until the Sun goes nova. Edited December 5, 2011 by jchd Taumantis and rcmaehl 2 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Taumantis Posted December 6, 2011 Author Share Posted December 6, 2011 well loop should do: 1. get color from cordination 2. if color is not 10846764 then loop end 3. go to the mouse click ... do until work like do while ? f.e do { int i; cin >> i; }while(i==1) if i will put 0 for i ,loop break and scrip go to the next line... sorry if my english is bad Link to comment Share on other sites More sharing options...
Taumantis Posted December 6, 2011 Author Share Posted December 6, 2011 i want to end loop when pixel on the posytion change color to 5153321 from 10846764 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 6, 2011 Moderators Share Posted December 6, 2011 (edited) Taumantis,Welcome the the AutoIt forum. The problem you have is that the Until @error will never fire as @error at that point has been set to 0 by the preceding MouseClick line:HotKeySet("^!x", "MyExit") Func MyExit() Exit EndFunc ;==>MyExit Opt("MouseCoordMode", 1) Do Sleep(100) MouseMove(1097, 760) MouseClick("left") Sleep(100) Do $i = PixelGetColor(1015, 760) Sleep(10) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<< Important to reduce the load on the CPU Until $i = 10846764 MouseClick("left") Until @error ; <<<<<<<<<< But error at this point is set by the MouseClick and so will always be 0What error do you want to act as the trigger for leaving the loop? M23Edit: Just seen your post. Why do you have 2 loops in that case? HotKeySet("^!x", "MyExit") Func MyExit() Exit EndFunc ;==>MyExit Opt("MouseCoordMode", 1) While 1 Sleep(100) MouseMove(1097, 760) MouseClick("left") Sleep(100) If PixelGetColor(1015, 760) = 10846764 Then ExitLoop ; This will take you to... MouseClick("left") WEnd ; ...here!Is that what you want? Edited December 6, 2011 by Melba23 Taumantis 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Taumantis Posted December 6, 2011 Author Share Posted December 6, 2011 (edited) yes, but second one is too i thinl. i want first do until is for working program until i put x ;p second one is to do what i want... stop and w8 for reaction... if reactions is good then go to the next step and if all is ok repeat ... and my second question how to Opt("MouseClickDownDelay", ) with pixel? i mean mouse lick is down if color at the x y is xxxxxxxxxx and relase if yyyyyyyyyy Edited December 6, 2011 by Taumantis Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 6, 2011 Moderators Share Posted December 6, 2011 Taumantis,So I understand that you want an outer loop which waits until you "put x" and then an inner loop to wait for a reaction. What exactly is "put x"? Is it a key? A coordinate? A colour? A lot depends on how you intend to interact with the script. M23 Taumantis 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Taumantis Posted December 6, 2011 Author Share Posted December 6, 2011 (edited) i want to hold the click button to the moment if on the cordinate x,y color change from color 1 to color 2, and then leave this relased to the moment if on the cordinate 2 x,y color change from color 1 to color 2 and then put it again. this loop have to broke if on the cordinate 3 x,y color change from color 3 to color 4. ;palgorithm look something like this.step1: click and hold, if on the cordinates (2) color change from color 3 to color 4 end the algorithm else: go step 2step2: if color on the coordinates (x,y) change from color 1 to color 2 relase button and go to the step 3.step3: if color on the coordinates (x,y) change from color 1 to color 2 go to step1: (there is not other option) Edited December 6, 2011 by Taumantis Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 6, 2011 Moderators Share Posted December 6, 2011 Taumantis,Is this getting closer: expandcollapse popupHotKeySet("^!x", "MyExit") Func MyExit() Exit EndFunc Opt("MouseCoordMode",1) ; Start an infinite loop While 1 ; Wait here until "cordinate x,y color change from color 1 to color 2" While 1 If PixelGetColor(x, y) = $iColor2 Then ExitLoop EndIf Sleep(10) WEnd ; Move the mouse to these coordinates MouseMove(1097,760) ; Mouse button down MouseDown("left") Sleep(100) ; Now wait here until "cordinate 2 x,y color change from color 1 to color 2" While 1 If PixelGetColor(x2, y2) = $iColor2 Then ExitLoop EndIf Sleep(10) WEnd ; And raise the mouse button MouseUp("left") ; And start again WEndA question: Do you not want a timeout on the 2 PixelColor loops? If you do not have one then if the colour does not change you will stay in them forever. Can you give some idea of what you are trying to do? There might be an easier way to do it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Taumantis Posted December 6, 2011 Author Share Posted December 6, 2011 (edited) bo be onest i want to write bot for facebook go fishing game only for my educational purpose ^^ there u have to click to set lure, w8 until color of the button change from brown to the green, then put the button nad hold it until mark change color from blue to light blue and then relase, relase to moment when blue change to ligh blue again and hold to the blue > ligh blue again... and repeat alll the time until on the coordinates on the middle screen change to to orange with "you catch the fish" but your post is helping me aout undestand the lagunage of autoit this is very helpfull Edited December 6, 2011 by Taumantis Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 6, 2011 Moderators Share Posted December 6, 2011 Taumantis,So I have been wasting my time on code for a game! Go and read the Forum Rules. You have broken the No 1 rule here and that is why you will get no more help from me or anyone else and this thread will soon be locked. And do not try to PM me about it either. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Taumantis Posted December 6, 2011 Author Share Posted December 6, 2011 u didnt wasted your time, i read somewhere that i should write easy bot script for some game to undestand that autoit etc. i dont play this ;p game but this game was the best choice to learn and it was very good example. And btw i didnt ask for writing bot i just wanted to help me with pixels. sorry if somethegin gone wrong Link to comment Share on other sites More sharing options...
Developers Jos Posted December 6, 2011 Developers Share Posted December 6, 2011 (edited) u didnt wasted your time, i read somewhere that i should write easy bot script for some game to undestand that autoit etc. i dont play this ;p game but this game was the best choice to learn and it was very good example. And btw i didnt ask for writing bot i just wanted to help me with pixels. sorry if somethegin gone wrongRead the rules and stick to it.Topic closed!oh, and it is not for you to judge whether you wasted somebodies time .... I can only agree that you are wasting peoples time in this forum. Edited December 6, 2011 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 comment Share on other sites More sharing options...
Recommended Posts