lilandywandy Posted October 26, 2005 Share Posted October 26, 2005 If PixelGetColor(1063,662) = Dec("103452") Then MouseClick("left", 1071,18, 1) MouseClick("left", 550,442, 1) Sleep(30000000000) and HotKeySet("{ESC}", "MyExit") WinActivate("[Conquer]") While 1 ; repeat statements over ; look for monster and attack him $CoordMonster = PixelSearch ( 0,0,800,800,0xbd0000,5 ) If Not @error Then MouseClick ( "Right" , $CoordMonster[0], $CoordMonster[1] , 1,1) EndIf ; if mana is empty replenish it If PixelGetColor( 119, 780) = (0x94929c) Then For $i = 3 to $i = 1 Step -1 Send("{F7}") Sleep(2000) Next EndIf Wend Func MyExit() Exit EndFunc i want code 2 to run as normal, but if at anytime (1063,662) = Dec("103452"), then do those functions main problem: i dont know how to organize ifs and ends Link to comment Share on other sites More sharing options...
Stumpii Posted October 26, 2005 Share Posted October 26, 2005 Something like this? It is not clear from your description what is supposed to happen when. Check out SciTe, Context check and Tidy as these make it easier to maintain code. Don't understand what the Sleep(3000...) is for. Why so long? ; Setup hotkey HotKeySet("{ESC}", "MyExit") ;Activate Game WinActivate("[Conquer]") While 1; repeat statements over If PixelGetColor(1063, 662) = Dec("103452") Then MouseClick("left", 1071, 18, 1) MouseClick("left", 550, 442, 1) Sleep(30000000000) ; look for monster and attack him $CoordMonster = PixelSearch(0, 0, 800, 800, 0xbd0000, 5) If Not @error Then MouseClick("Right", $CoordMonster[0], $CoordMonster[1], 1, 1) EndIf ; if mana is empty replenish it If PixelGetColor(119, 780) = (0x94929c) Then For $i = 3 To 1 Step - 1 Send("{F7}") Sleep(2000) Next EndIf EndIf WEnd Func MyExit() Exit EndFunc ;==>MyExit Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
lilandywandy Posted October 26, 2005 Author Share Posted October 26, 2005 well i used to run both seperately, but i found that it was too troublesome to open 2 autoit scripts so i just wanted to combine them, but still operating the same way it used to (2 opened seperatly) Link to comment Share on other sites More sharing options...
Stumpii Posted October 26, 2005 Share Posted October 26, 2005 (edited) well i used to run both seperately, but i found that it was too troublesome to open 2 autoit scripts so i just wanted to combine them, but still operating the same way it used to (2 opened seperatly)You something something like this?; Setup hotkey HotKeySet("{ESC}", "MyExit") ;Activate Game WinActivate("[Conquer]") While 1; repeat statements over If PixelGetColor(1063, 662) = Dec("103452") Then MouseClick("left", 1071, 18, 1) MouseClick("left", 550, 442, 1) Sleep(30000000000) EndIf ; look for monster and attack him $CoordMonster = PixelSearch(0, 0, 800, 800, 0xbd0000, 5) If Not @error Then MouseClick("Right", $CoordMonster[0], $CoordMonster[1], 1, 1) EndIf ; if mana is empty replenish it If PixelGetColor(119, 780) = (0x94929c) Then For $i = 3 To 1 Step - 1 Send("{F7}") Sleep(2000) Next EndIf WEnd Func MyExit() Exit EndFunc ;==>MyExitNote that if you want the two time delays, but don't want the one delay to affect the other then you are better off keeping the two as seperate scripts, compiling them and then calling them from a third script that will be the one that you, the user, executes. This way they can run independantly, other wise you will need to stop using Sleep and perform a time delay comparison function yourself which can be a pain. Edited October 26, 2005 by Stumpii Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
lilandywandy Posted October 26, 2005 Author Share Posted October 26, 2005 k thnx works like a charm but 1 question, how come pixelgetcolor is so slow? like it finds 1 point, then like 15 secs later, it finds a second one... is there a way to make it instant? Link to comment Share on other sites More sharing options...
Zithen Posted October 26, 2005 Share Posted October 26, 2005 someone correct me if i am wrong on this. but the reason its slow is because of the large area that you are searching. it has to look at every pixle one by one. try stepping it out by 2-3 pixels. Link to comment Share on other sites More sharing options...
Stumpii Posted October 26, 2005 Share Posted October 26, 2005 PixelGetColor should be fast, PixelSearch will be slow. An area of 800x800 is 640,000 pixels to search (128,000 by stepping 5 pixels at a time). As PixelSearch is CPU work, the time will vary greatly depending on how fast a CPU you have. I have used PixelSearch before and found that what works on my PC runs very slow on someone elses PC if they have even a slightly older computer. Try narrowing the check area to 100, 100, 700, 700 or increasing the step of the PixelSearch. A step 0f 5 sounds reasonable though. What speed CPU do you have? What game if this for anyway? Command & Conquer? Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
lilandywandy Posted October 26, 2005 Author Share Posted October 26, 2005 no its conqueronline --- conqueronline.com $CoordMonster = PixelSearch(0, 0, 800, 800, 0xbd0000, 5) that does the 5 mean anyways? Link to comment Share on other sites More sharing options...
Stumpii Posted October 26, 2005 Share Posted October 26, 2005 no its conqueronline --- conqueronline.com$CoordMonster = PixelSearch(0, 0, 800, 800, 0xbd0000, 5)that does the 5 mean anyways?The five means only check every 5th pixel, i.e. pixel 0, 4, 9 etc. This is five time faster than checking every pixel. Of course, if you are looking for an object of width 3, then it might get missed with a step of 5. Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity. Link to comment Share on other sites More sharing options...
w0uter Posted October 26, 2005 Share Posted October 26, 2005 when doing stuff like this i always SetProccesPriority(@autoitPID,5) My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
lilandywandy Posted October 28, 2005 Author Share Posted October 28, 2005 5 pixels horizontal or vertically? Link to comment Share on other sites More sharing options...
LxP Posted October 31, 2005 Share Posted October 31, 2005 In my tests PixelSearch() scans vertically. 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