rosenman Posted June 15, 2008 Share Posted June 15, 2008 Hi, guys.I'm new in the forum.Sorry for the stupid post but i'm actually don't understand the program quiet well.My question is that, is there possibility anybody to write me a script.I think that the script wouldn't be long.I need AutoIT to scan area of the screen for a color and when the color pop up the script to click at left shift button.I use resolution 800x600 and the scan area have to be 370-420 at X and 110-160 at Y coordinates.Thanks in advance people. Link to comment Share on other sites More sharing options...
TehWhale Posted June 15, 2008 Share Posted June 15, 2008 Some great functions to use: PixelSearch() MouseClick() Send() Check the helpfile on these, and read up about them! A Example: $Color = color goes here... While 1 $Pixel = PixelSearch(370, 420, 110, 160, $Color, 5) Send("{Shift Down}") MouseClick("left", $Pixel[0], $Pixel[1]) Send("{Shift Up}") WEnd Warning: The above code may not work. It is an example to show you how to do this. Link to comment Share on other sites More sharing options...
rosenman Posted June 15, 2008 Author Share Posted June 15, 2008 Well a minute before read your post i write something like that you post here. ;NFS Underground 2 While 1 $Pixel = PixelSearch( 370, 420, 110, 160, 0x00FE00) Send("LSHIFT") Wend But when i start that script if it gets the color in the scan area it starts to push SHIFT and never stops. Is there any way to avoid that? Link to comment Share on other sites More sharing options...
TehWhale Posted June 15, 2008 Share Posted June 15, 2008 Try using: If Not @Error Then Send("{LSHIFT}") MouseClick("Left", $Pixel[0], $Pixe[1]) EndIf But you can always set it to a hotkey, if it is working too fast for you. Link to comment Share on other sites More sharing options...
rosenman Posted June 15, 2008 Author Share Posted June 15, 2008 This time nothing happens.Only slow down computer. Link to comment Share on other sites More sharing options...
TehWhale Posted June 15, 2008 Share Posted June 15, 2008 That's probably because it didn't find the pixel your looking for. Link to comment Share on other sites More sharing options...
rosenman Posted June 15, 2008 Author Share Posted June 15, 2008 Can you see the picture that i attached to this post.See the cords i think that i'm not making mistake. Link to comment Share on other sites More sharing options...
rosenman Posted June 15, 2008 Author Share Posted June 15, 2008 (edited) Finally i wrote a code that works but not full functionally. WinWaitActive("NFS Underground 2 - Window Mode By Wiccaan") While 1 $pixel=PixelSearch(0,0,800,600,0x00FE00) If IsArray($pixel) = 1 Then Send("{LSHIFT}") EndIf WEnd Is there a way to speed up the things because when i start the script my pc lags... I stop everything except the game and the script.I make the game 640x480 and low the graphic details and still when i run the script my pc lags.It cant respond as quickly as i want to Is there any way to avoid that lag? I think i have to make the script to scan not the full screen but only the spot with exact color but i don't know how. Can anyone help me? Edited June 15, 2008 by rosenman Link to comment Share on other sites More sharing options...
TehWhale Posted June 15, 2008 Share Posted June 15, 2008 Set specific coordinates where the shift up thing is, and set a small sleep in your loop because it's CONSTANTLY checking for that pixel, slow it down to like: Sleep(10). With Best Hopes, J.B. Link to comment Share on other sites More sharing options...
rosenman Posted June 15, 2008 Author Share Posted June 15, 2008 Would you help me with setting the pixel scan?I cannot understand what to put in the $pixel=PixelSearch(0,0,800,600,0x00FE00). How to set here X to X axis and Y to Y axis? Thanks in advance. Link to comment Share on other sites More sharing options...
rosenman Posted June 15, 2008 Author Share Posted June 15, 2008 I look the code for PixelSearch: PixelSearch ( left, top, right, bottom, color , shade-variation , step , hwnd ) Than i Fill it up. Left pixel = 460 Top pixel = 165 Right Pixel = 465 Bottom pixel = 170 Color = 0x00FE00 PixelSearch (460,165,465,170,0x00FE00) And this not works for me.When i change it to PixelSearch (0,0,465,170,0x00FE00) Than it works but still slow down the pc. How to make the PixelSearch to search only in this 5 pixel square from X axis 460-465 and Y axis 165-170. Please help. Link to comment Share on other sites More sharing options...
TehWhale Posted June 15, 2008 Share Posted June 15, 2008 PixelSearch ( left, top, right, bottom, color , shade-variation , step , hwnd )Set the Step to 5. 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