Disciples Posted July 29, 2009 Share Posted July 29, 2009 Func LifeMonitor() $pixels = PixelSearch (186,149,423,166,0xc81A1A) For $x = 1 To $pixels If $pixels < (263,156) Then MouseClick("left",746,326) Sleep(30000) EndIf EndFunc I'm still very new to coding so I'm not sure what I am doing wrong. But here is what I'm trying to do. If a red pixel is before (to the left) or < that screen coord, then it would left click at that coord. Any help would be greatly appreciated Thanks. Link to comment Share on other sites More sharing options...
Disciples Posted July 29, 2009 Author Share Posted July 29, 2009 Actually, the only thing I really need to know, is how would I make it so if the red pixel is to the left of the screen coord, it would mouseclick. Thanks for help Link to comment Share on other sites More sharing options...
UnknownWarrior Posted July 29, 2009 Share Posted July 29, 2009 Actually, the only thing I really need to know, is how would I make it so if the red pixel is to the left of the screen coord, it would mouseclick.Thanks for helpAs I told you... First of I don't even no if your < sign will work... And even if it does $pixel has 4 groups of numbers to it.... and your ( ) has only 2... So it can't correctly compare >< Link to comment Share on other sites More sharing options...
Disciples Posted July 29, 2009 Author Share Posted July 29, 2009 As I told you... First of I don't even no if your < sign will work... And even if it does $pixel has 4 groups of numbers to it.... and your ( ) has only 2... So it can't correctly compare ><The < won't work. That's why I am scratching that.And what do you mean by my () has only 2? Link to comment Share on other sites More sharing options...
UnknownWarrior Posted July 29, 2009 Share Posted July 29, 2009 The < won't work. That's why I am scratching that. And what do you mean by my () has only 2? My bad, I messed up telling you that... But it still is wrong nonetheless xP Heres what it should look like: If $Pixel[0] < 263 Then If $Pixel[1] < 156 Then MsgBox(0,"", "It is less than!") EndIf EnnIf Something along those lines $pixel[0] = x coord received from the pixel search $pixel[1] = y Link to comment Share on other sites More sharing options...
Disciples Posted July 30, 2009 Author Share Posted July 30, 2009 BUMP And here's what I have now... expandcollapse popupHotKeySet("{F3}", "_Start") HotKeySet("^i", "_ToggleRun") HotKeySet("{ESC}", "_Exit") Global $ON = False Global $Running = 0, $MPos, $PixelColor While 1 If $ON = True Then _Search() _ToggleRun() Life() Sleep(10) WEnd Func _Start() MouseClick ("left", 610,223) sleep(100) $ON = True EndFunc ;==>_Start Func _Stop() $ON = False EndFunc ;==>_Stop Func _Exit() $ON = False Exit EndFunc ;==>_Exit Func _Search() $Colors = StringSplit("0xc81A1A ", ",") For $x = 1 To $Colors[0] $coord = PixelSearch(445,339,689,381, $Colors[$x]) ;searches for monster, if not found keeps searching If Not @error Then MouseClick("left",503,349) sleep(0) MouseClick("left",502,365) sleep(0) MouseClick("left",508,355) sleep(0) MouseClick("left",510,375) sleep(0) MouseClick("left",513,371) sleep(0) Return EndIf Next If @error Then MouseClick("left",256,326) EndIf EndFunc ;==>_Search Func _ToggleRun() $Running = NOT $Running If $ON Then $MPos = MouseGetPos() $PixelColor = PixelGetColor($MPos[0], $MPos[1]) EndIf EndFunc Func Life() If $PixelColor <> PixelGetColor($MPos[0], $MPos[1]) Then MouseClick ("left",745,330) Sleep(30000) EndIf EndFunc I get this error : Line 89 If $PixelColor <> PixelGetColor($MPos[0], $MPos[1]) Then If $PixelColor <> PixelGetColor($MPos^ ERROR Error: Subscript used with non-Array variable. So, I had the script running before, but it seemed the hotkeys weren't working, because it would just start as soon as I ran it. So I tried to change some stuff, but couldn't find anything wrong, so I went to run it again and I got this error. Link to comment Share on other sites More sharing options...
Disciples Posted July 30, 2009 Author Share Posted July 30, 2009 Bump 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