kabalarian Posted August 6, 2005 Share Posted August 6, 2005 Is there a way to make the script pause until a pixel changes colors? From say, red -> green. Link to comment Share on other sites More sharing options...
/dev/null Posted August 6, 2005 Share Posted August 6, 2005 Is there a way to make the script pause until a pixel changes colors? From say, red -> green.<{POST_SNAPBACK}>yes, search the help file and the forum for: PixelGetColor().CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 6, 2005 Moderators Share Posted August 6, 2005 And Help File for Do... Until Example: Do Sleep(100) Until PixelGetColor() 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. Link to comment Share on other sites More sharing options...
kabalarian Posted August 6, 2005 Author Share Posted August 6, 2005 (edited) okay so i did that and it worked fine...im getting error s out the wazoo...ill post the code here in a minute after i re-work it and test itOkay so i get undefined global variable errors fom this codeDim $hp $d2win=InputBox("Diablo II Window", "Enter the title of your Diablo II window.", "Diablo II", "", 150, 60) WinWait($d2win) WinActivate($d2win) $check=PixelGetColor(400, 90) If $check="5787720" Then Do Sleep(100) Until $hp = PixelGetColor(80, 590) If $hp="4737096" Then Send("1", 1) EndIf EndIfEDIT: (updated code) okay so i was looking around and saw something about Dim $variable so now i get no errors..but my script does nothing but run then close Edited August 6, 2005 by kabalarian Link to comment Share on other sites More sharing options...
therks Posted August 6, 2005 Share Posted August 6, 2005 (edited) Not quite like that. You need to have it do the sleep until the color changes. Change your Do..Until loop to something like ;Stuff before Do $hp = PixelGetColor(80, 590) Sleep(100) Until $hp = 4737096 ;Stuff after See, this will constantly check the pixel at 80x590 until it's green or whatever colour that is. Then it will exit the Do..Until loop, and execute whatever code comes after. This is just an example, it's not copy & paste code, you'll have to tailor it to your needs. Edited August 6, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
kabalarian Posted August 6, 2005 Author Share Posted August 6, 2005 (edited) so that will continue to check even after the first time it finds the pixel changed colors? EDIT: Okay so now it is updated to what usaid but it will just run then exit... Dim $hp $d2win=InputBox("Diablo II Window", "Enter the title of your Diablo II window.", "Diablo II", "", 150, 60) WinWait($d2win) WinActivate($d2win) WinWaitActive($d2win) $check=PixelGetColor(400, 90) If $check="5787720" Then Do $hp = PixelGetColor(80, 590) Sleep(100) Until $hp="4737096" While $hp="4737096" Send("1", 1) WEnd EndIf EDIT2: No one will help me?...ive been lookin through the help file for a while now and still cant find an answer to my problems Edited August 7, 2005 by kabalarian Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 7, 2005 Moderators Share Posted August 7, 2005 (edited) Dim $hp $d2win=InputBox("Diablo II Window", "Enter the title of your Diablo II window.", "Diablo II", "", 150, 60) WinWait($d2win) WinActivate($d2win) WinWaitActive($d2win) $check=PixelGetColor(400, 90) While WinExists($d2win) If $check = 5787720 Then Do $hp = PixelGetColor(80, 590) Sleep(100) Until $hp = 4737096 Do Send("1", 1) Sleep(100) Until Not $hp= 4737096 EndIf Sleep(100) Wend Edited August 7, 2005 by ronsrules 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. Link to comment Share on other sites More sharing options...
/dev/null Posted August 7, 2005 Share Posted August 7, 2005 (edited) so that will continue to check even after the first time it finds the pixel changed colors?EDIT: Okay so now it is updated to what usaid but it will just run then exit...The script exits due to the first IF clause. If the pixel color is not 5787720, then the whole code block will be skipped and your programm exits.Please explain a bit more when you want the script to wait and how to detect the "trigger" for this.BTW#1: The coordinates in the two function calls to PixelGetColor() are different! Do you want to check one pixel or two?BTW#2: The while loop in you script (While $hp="4737096") will never end, as $hp will not change while the loop executes.CheersKurt Edited August 7, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
kabalarian Posted August 7, 2005 Author Share Posted August 7, 2005 (edited) the script i posted is unfinished...it has just the bare bones to make it work...the first pixelcheck is to detect if its a different size...i havent gotten to writing the second If for the script to run on a different size.I want the script to constantly check the pixel at (80, 590) as that is where the hp ball meats the color "4737096" as soon as that pixel changes from red to a goldish or brownish color i want it to send the keypress of 1...up near F1...EDIT: this is sorta like the post here except for a much diffferent game Edited August 7, 2005 by kabalarian 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