LiquidPerceptions Posted April 11, 2007 Share Posted April 11, 2007 Ok, so here's the jist of things. I'm basically trying to create an executable that will scan for "orange" and "white". Now I need "white" to collide into "orange" using the arrow keys, and "orange" dissapears after white collides, but reappears in a new location. I have used PixelSearch before, but only with mouse controls. Here is the script I have written so far, (keep in mind I'm pretty newb to AU3) Do $orange = PixelSearch( 604, 199, 905, 581, "13997312") if not @error Then $white = PixelSearch( 604, 199, 905, 581, "12895428") EndIf if not @error Then Do If $white[0] > $orange[0] then send("{LEFT}") EndIf If $white[0] < $orange[0] then send("{RIGHT}") EndIf If $white[1] > $orange[1] Then send("{UP}") EndIf If $white[1] > $orange[1] Then send("{DOWN}") EndIf until 1 = 0 EndIf until 1 = 0 Now when I run this, white will normally collide into orange one time, but then keep going as if orange were still there. How can I write an "until" statement to stop movement on the white until a new orange comes up? "I'm not here to make decisions, I'm here to make a difference" Link to comment Share on other sites More sharing options...
jokke Posted April 11, 2007 Share Posted April 11, 2007 (edited) expandcollapse popupDo $orange = PixelSearch( 604, 199, 905, 581, "13997312") If Not @error Then $white = PixelSearch( 604, 199, 905, 581, "12895428") EndIf If Not @error Then Do If $white[0] > $orange[0] Then Send("{LEFT}") EndIf If $white[0] < $orange[0] Then Send("{RIGHT}") EndIf If $white[1] > $orange[1] Then Send("{UP}") EndIf If $white[1] < $orange[1] Then Send("{DOWN}") EndIf Until 1 = 0 ;Until what is 0, Think you actually have to have a $var here. EndIf Until 1 = 0 ;Also until what? oÝ÷ Ù.(!·§¶Ú¢+l¢g°«eG+ºÚ"µÍÌÍÝHBÂIÌÍÛÜ[ÙHH^[ÙXÚ NNKL K NK ][ÝÌLÎNMÌÌL][ÝÊBIÌÍÝÚ]HH^[ÙXÚ NNKL K NK ][ÝÌLMM ][ÝÊBBBBRY ÌÍÝÚ]VÌH ÝÈ ÌÍÛÜ[ÙVÌH[BTÙ[ ][ÝÞÓQI][ÝÊBBIÌÍÝHQ[YBBBRY ÌÍÝÚ]VÌH È ÌÍÛÜ[ÙVÌH[BTÙ[ ][ÝÞÔQÒI][ÝÊBBIÌÍÝHQ[YBBBRY ÌÍÝÚ]VÌWH ÝÈ ÌÍÛÜ[ÙVÌWH[BTÙ[ ][ÝÞÕTI][ÝÊBBIÌÍÝHQ[YBBRY ÌÍÝÚ]VÌWH È ÌÍÛÜ[ÙVÌWH[BTÙ[ ][ÝÞÑÕÓI][ÝÊBBIÌÍÝHQ[YBB[[ ÌÍÝH Edited April 11, 2007 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
LiquidPerceptions Posted April 11, 2007 Author Share Posted April 11, 2007 The second "until" was to keep the entire script in loop. The script you wrote doesn't post an error, but just closes after about a second from being open. expandcollapse popupDo $orange = PixelSearch( 604, 199, 905, 581, "13997312") If Not @error Then $white = PixelSearch( 604, 199, 905, 581, "12895428") EndIf If Not @error Then Do If $white[0] > $orange[0] Then Send("{LEFT}") EndIf If $white[0] < $orange[0] Then Send("{RIGHT}") EndIf If $white[1] > $orange[1] Then Send("{UP}") EndIf If $white[1] < $orange[1] Then Send("{DOWN}") EndIf Until 1 = 0 ;Until what is 0, Think you actually have to have a $var here. EndIf Until 1 = 0 ;Also until what? oÝ÷ Ù.(!·§¶Ú¢+l¢g°«eG+ºÚ"µÍÌÍÝHBÂIÌÍÛÜ[ÙHH^[ÙXÚ NNKL K NK ][ÝÌLÎNMÌÌL][ÝÊBIÌÍÝÚ]HH^[ÙXÚ NNKL K NK ][ÝÌLMM ][ÝÊBBBBRY ÌÍÝÚ]VÌH ÝÈ ÌÍÛÜ[ÙVÌH[BTÙ[ ][ÝÞÓQI][ÝÊBBIÌÍÝHQ[YBBBRY ÌÍÝÚ]VÌH È ÌÍÛÜ[ÙVÌH[BTÙ[ ][ÝÞÔQÒI][ÝÊBBIÌÍÝHQ[YBBBRY ÌÍÝÚ]VÌWH ÝÈ ÌÍÛÜ[ÙVÌWH[BTÙ[ ][ÝÞÕTI][ÝÊBBIÌÍÝHQ[YBBRY ÌÍÝÚ]VÌWH È ÌÍÛÜ[ÙVÌWH[BTÙ[ ][ÝÞÑÕÓI][ÝÊBBIÌÍÝHQ[YBB[[ ÌÍÝH "I'm not here to make decisions, I'm here to make a difference" 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