bigassmuffin Posted June 9, 2006 Posted June 9, 2006 (edited) So first I want this to start if you hold down the shift button..clearly this is: How do I do this simple part? When you hold mouse down, I want the screen to constantly look for the color red (almsot a red, the hex color I put there is correct) $coord = PixelSearch( 0, 1023, 0, 651, 0xB50400 ) If Not @error Then MsgBox(No monsters were found) EndIf Now if it does locate the hex color 0xB50400, I want the mouse to move 12 pixels underneath/below where it found the hex color... This is where I need major help on THANK YOU FOR YOUR TIME AND HELP IF YOU GIVE HELP! Edited June 9, 2006 by bigassmuffin
bucky002 Posted June 9, 2006 Posted June 9, 2006 Wait which is key needs to be held down to start searching? Shift or the mouse?
bucky002 Posted June 9, 2006 Posted June 9, 2006 Set a hotkey like this HotKeySet("+l", "Search")oÝ÷ Ù8Z·l¶ Ëh~+@±ú+Ê«¢Ø^®«²Ø¨f²mëkÉ«¢+ØÀÌØí½½ÉôA¥á±MÉ À°ÄÀḚ̀À°ØÔİÁáÔÀÐÀÀ¤)%%ÍÉÉä ÀÌØí½½É¤ôÄQ¡¸(%5½ÕÍ ±¥¬ Ìäí±ÐÌäì°ÀÌØí½½ÉlÁt°ÀÌØí½½ÉlÅt´Ä԰İÀ¤(%M±À ÔÌÀ¤)¹% Can't remember if x or y is up and down just mess around with it a bit, it might work.
bigassmuffin Posted June 9, 2006 Author Posted June 9, 2006 (edited) Set a hotkey like this HotKeySet("+l", "Search")oÝ÷ Ù8Z·l¶ Ëh~+@±ú+Ê«¢Ø^®«²Ø¨f²mëkÉ«¢+ØÀÌØí½½ÉôA¥á±MÉ À°ÄÀḚ̀À°ØÔİÁáÔÀÐÀÀ¤)%%ÍÉÉä ÀÌØí½½É¤ôÄQ¡¸(%5½ÕÍ ±¥¬ Ìäí±ÐÌäì°ÀÌØí½½ÉlÁt°ÀÌØí½½ÉlÅt´Ä԰İÀ¤(%M±À ÔÌÀ¤)¹% Can't remember if x or y is up and down just mess around with it a bit, it might work. HotKeySet("+l", "Search")? I never heard of this.. Edit: And it doesnt work because of the HotKeySet("+l", "Search") But thank you for other part of code so far! Edited June 9, 2006 by bigassmuffin
bucky002 Posted June 9, 2006 Posted June 9, 2006 (edited) HotKeySet("+l", "Search")? I never heard of this..I'll explain.. If you press Shift and "l" (L) at the same time it will call the function. (I should have done like q or something so you wouldn't get confused). Like this Hotkeyset("+l", "Search") While 1 Sleep(250) WEnd Func Search() Msgbox(0, "Yippee", "You pressed Shift + l....Congratulations!") EndFunc Press Shift and l at the same time and see what happens. Edit: I swear Smoke N just posted. Why did it get deleted? I have picture for proof I'll threatin' to release unless I get an answer! Edited June 9, 2006 by bucky002
bigassmuffin Posted June 9, 2006 Author Posted June 9, 2006 Ok, what u hshowed me with msg box works, but wen i try: Hotkeyset("+l", "Search") Func Search() $coord = PixelSearch( 0, 1023, 0, 651, 0xB50400 ) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 15, 1, 0) Sleep(530) EndIf EndFunc it does not work
bucky002 Posted June 9, 2006 Posted June 9, 2006 (edited) Hmm, maybe something like this? WinWaitActive(;Game Name) $color = 0xB50400 $game = 0 HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 1023, 0, 651, $color) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 15, 1, 0) Sleep(530) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc to the window name. Use the autoit window info tool to find out. Still confused why Smoke N's post is gone.... Edited June 9, 2006 by bucky002
bigassmuffin Posted June 9, 2006 Author Posted June 9, 2006 Hmm, maybe something like this? WinWaitActive(;Game Name) $color = 0xB50400 $game = 0 HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 1023, 0, 651, $color) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 15, 1, 0) Sleep(530) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc to the window name. Use the autoit window info tool to find out.Wow, THANK YOU FOR SPENDIN SPO MUCH TIME, one problem though, the game active window has the cahracters [, ], and . So autoit keeps thinking its a new funciton, so I cant use WinWAitActive on this
bucky002 Posted June 9, 2006 Posted June 9, 2006 (edited) What's the window name? You could probably do Opt("WinTitleMatchMode", 2) WinWaitActive(;Game Name) $color = 0xB50400 $game = 0 HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 1023, 0, 651, $color) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 15, 1, 0) Sleep(530) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc I still need to know the window name though. Otherwise the code above probably won't work. Edited June 9, 2006 by bucky002
Paulie Posted June 9, 2006 Posted June 9, 2006 Wow, THANK YOU FOR SPENDIN SPO MUCH TIME, one problem though, the game active window has the cahracters [, ], and . So autoit keeps thinking its a new funciton, so I cant use WinWAitActive on this make sure you put it all in quotes winwaitactive("[Game,name]") should work
bigassmuffin Posted June 9, 2006 Author Posted June 9, 2006 What's the window name? You could probably do Opt("WinTitleMatchMode", 2) WinWaitActive(;Game Name) $color = 0xB50400 $game = 0 HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 1023, 0, 651, $color) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 15, 1, 0) Sleep(530) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc I still need to know the window name though. Otherwise the code above probably won't work. [Conquer2.0] [] and . are part of name
Paulie Posted June 9, 2006 Posted June 9, 2006 [Conquer2.0] [] and . are part of nameAre you sure WinWaitActive("[Conquer2.0]") Doesn't work? anyything in quotes is called a "string" in autoit, and strings should not be broken by commas periods or brackets unless you end the Double quotes if not, maybe "WinSetTitle" will help you
bucky002 Posted June 9, 2006 Posted June 9, 2006 (edited) Since you are using WinTitleMatchMode this should work. Opt("WinTitleMatchMode", 2) WinWaitActive("Conquer") $color = 0xB50400 $game = 0 HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 1023, 0, 651, $color) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 15, 1, 0) Sleep(530) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc Also I don't think it will work because I think your pixel search is messed up. All you are searching is "Left" and "Right" when you need to also know "Top" and "Bottom". Edited June 9, 2006 by bucky002
bucky002 Posted June 9, 2006 Posted June 9, 2006 (edited) This is what I want you to do. Open your game then open Autoit Window info tool usually located at C:\Program Files\AutoIt3\Au3Info.exe Then click anywhere on the screen next take a screenshot of it or copy and paste what is inside it. Edited June 9, 2006 by bucky002
Paulie Posted June 9, 2006 Posted June 9, 2006 Also I don't think it will work because I think your pixel search is messed up. All you are searching is "Left" and "Right" when you need to also know "Top" and "Bottom". Thats the money right there, your pixelsearch is totally inverted, you have it searching one line of pixel on the far left of your screen, just to test if this is the problem w/ script try doing this PixelSearch(0,0,1279,1023, color) This is a whole screen search
Daniel W. Posted June 9, 2006 Posted June 9, 2006 Dont you think this is whole screen? PixelSearch( 0 , 0 , @DesktopWidth - 1 , @DesktopHeight - 1, color ) --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]
Paulie Posted June 9, 2006 Posted June 9, 2006 Dont you think this is whole screen? PixelSearch( 0 , 0 , @DesktopWidth - 1 , @DesktopHeight - 1, color ) Yes that is too, but i knew his resolution fit that because he had already made a search, he just but the nubers in the wrong place, and i didn't want to confuse with macros
bigassmuffin Posted June 9, 2006 Author Posted June 9, 2006 (edited) Still doesnt work, the error says: Opt("[Conquer2.0]", 2) Error: Unkown option or bad parameter specified.. I used this code: Opt("[Conquer2.0]", 2) WinWaitActive("Conquer") $color = 0xB50400 $game = 0 HotKeySet("+p", "Play") HotKeySet("{ESC}", "quit") While 1 If $game = 1 Then $coord = PixelSearch( 0, 0, 1023, 651, $color) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1] - 15, 1, 0) Sleep(530) EndIf EndIf WEnd Func Play() If $game < 1 Then $game = $game + 1 Else $game = 0 EndIf EndFunc Func quit() Exit EndFunc Edited June 9, 2006 by bigassmuffin
Moderators SmOke_N Posted June 9, 2006 Moderators Posted June 9, 2006 Opt("[Conquer2.0]", 2) should be Opt('WinTitleMatchMode', 2) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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