robotmad50 Posted December 28, 2015 Share Posted December 28, 2015 Boolean error on line 44It doesn't like it when I do !seenGreen (a boolean) on 47Having some trouble with PixelSearch using an array in colors on 51More boolean trouble on line 55Having some trouble with PixelSearch using an array in colors on 63 fishEZ.au3 Link to comment Share on other sites More sharing options...
Trong Posted December 28, 2015 Share Posted December 28, 2015 (edited) lack of $ before the variable nameexpandcollapse popup; scans for green values, if green, it holds the LMB ; scans for red values, if red, it lets go, if it doesn't see red, it holds the LMB ; scans for indicator, if indicator, it stops fishing ;greenINDI = green ! redINDI = red ! INDI = dock HotKeySet("{ESC}", "Terminate") HotKeySet("!g", "startBot"); Global $greenINDI[3] Global $redINDI[3] Global $INDI Global $seenGreen MsgBox(0, "BOT START", "Bot has started and is idling.") Func Terminate() Exit 1 EndFunc ;==>Terminate Func startBot() ;clicks to start charge --done ;waits 20-500 ms --done ;clicks --done MsgBox(0, "fishEZ", "Gone fishing!") ;;indicates bot has started Local $rng $rng = Random(50, 200, 0) MouseClick('Left') ;single click to start charge bar going up and down Sleep($rng) ;sleep allows the charge bar to rise MouseClick('Left') ;stops the charge from moving and throws the hook into the water ;Call("GreenINDI") ; puts colors into greenINDI GreenINDI() ;Call("RedINDI") ; puts colors into redINDI RedINDI() Local $screenCoords = WinGetPos("[ACTIVE]") $seenGreen = False While 1 While $seenGreen ;this while should search for green $rng = Random(0, 2, 0) ;searches for green $point = PixelSearch(($screenCoords[2] * .25), ($screenCoords[3] * .25), ($screenCoords[2] * .75), ($screenCoords[3] * .75), $greenINDI[$rng]) If IsArray($point) Then MouseDown('Left') ;stop searching for green $seenGreen = True EndIf Sleep(50) WEnd While $seenGreen = True ;this while should search for red, and should only search when it has seen green $rng = Random(0, 2, 0) ;searches for red $point = PixelSearch(($screenCoords[2] * .25), ($screenCoords[3] * .25), ($screenCoords[2] * .75), ($screenCoords[3] * .75), $redINDI[$rng]) If IsArray($point) Then MouseUp('Left') EndIf MouseDown('Left') ;with any luck, this should hold LMB down if at any time red was seen Sleep(50) WEnd WEnd EndFunc ;==>startBot Func GreenINDI() ;assigns 3 green colors to greenINDI $greenINDI[0] = "0x1ED72C" $greenINDI[1] = "0x1BCD1F" $greenINDI[2] = "0x1FDA26" EndFunc ;==>GreenINDI Func RedINDI() ;assigns 3 red colors to redINDI $redINDI[0] = "0xF40001" $redINDI[1] = "0xF30101" $redINDI[2] = "0xEE0101" EndFunc ;==>RedINDI While 1 Sleep(250) WEnd Edited December 28, 2015 by Trong Regards, Link to comment Share on other sites More sharing options...
robotmad50 Posted December 28, 2015 Author Share Posted December 28, 2015 (edited) I cannot believe I missed the $ on line 44. Can that while(47) work as while false? And from what I can tell, you did not provide a solution to 51 and 63 Edited December 28, 2015 by robotmad50 Link to comment Share on other sites More sharing options...
Trong Posted December 28, 2015 Share Posted December 28, 2015 (edited) if it is not variable, it is a function, but I do not see that function is declared in the scriptdata can not be assigned to the functionline 47 : it was not way call the function.... You should read how to use variables and functions here:https://www.autoitscript.com/autoit3/docs/intro/lang_variables.htmhttps://www.autoitscript.com/autoit3/docs/intro/lang_functions.htmhttps://www.autoitscript.com/wiki/Best_coding_practices Edited December 28, 2015 by Trong Regards, Link to comment Share on other sites More sharing options...
robotmad50 Posted December 28, 2015 Author Share Posted December 28, 2015 I see what you are talking about. My brain was deleting the $s you put in your post. I get it now. I was missing the $s for pretty much all of my errors except for line 47. I am still confused about line 47, how do I make it say while seenGreen = true even though it is false? From my understanding, put a ! in front means the opposite, but this does not seem to work in Autoit. Link to comment Share on other sites More sharing options...
Trong Posted December 28, 2015 Share Posted December 28, 2015 (edited) https://www.autoitscript.com/autoit3/docs/intro/lang_operators.htm While $expression ;$expression=True then True - $expression=False then False While Not $expression ;$expression=False then True - $expression=False then True While $seenGreen = True ;True=1 $seenGreen=True then True $seenGreen=False then False While $seenGreen = False ;False=0 $seenGreen=False then True $seenGreen=False then True Edited December 28, 2015 by Trong Regards, Link to comment Share on other sites More sharing options...
robotmad50 Posted December 28, 2015 Author Share Posted December 28, 2015 Aha, that is exactly what I needed. Thank you very much for your help. I apologize if I jumped the gun and chewed you out in my reply to your post. My brain was deleting the $s from your revision post. Thank you very much for your help. Link to comment Share on other sites More sharing options...
Trong Posted December 28, 2015 Share Posted December 28, 2015 Welcome to AutoIt and the forum! Regards, Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 28, 2015 Moderators Share Posted December 28, 2015 robotmad50,Which game are you automating?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...
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