clasher Posted February 2, 2009 Share Posted February 2, 2009 Hi all, I am trying to make a code that try to determine change in 3 different zone of the screen, and response different about which is happened, for this reason I try to write a script which uses pixelchecksums in a ring way:) But this script is not working. Mainly the main purpose was just jumping from 1 to another than return back func buyingcheck() $checksum = PixelChecksum(1100, 60, 1260, 480) while $checksum =PixelChecksum(1100, 60, 1260, 480) sleep(100) sellingcheck() wend msgbox(0," ", "buying mode") EndFunc func sellingcheck() $checksum = PixelChecksum(630, 600, 640, 615) while $checksum =PixelChecksum(630, 600, 640, 615) sleep(100) withdrawncheck() wend msgbox(0," ", "selling mode") EndFunc func withdrawncheck() $checksum = PixelChecksum(560,370, 570, 380) while $checksum =PixelChecksum(560,370, 570, 380) sleep(100) buyingcheck() wend msgbox(0," ", "withdrawn") EndFunc func buyingcheck() func sellingcheck() func withdrawncheck() these are the 3 functions that is controlling their respective zones. and the respective pixels are in there, I tried this code but not worked. Is there anyone who has some opinion about this code? BEst regards, Link to comment Share on other sites More sharing options...
youknowwho4eva Posted February 2, 2009 Share Posted February 2, 2009 It appears that first off you never start the first function. Second the while statements will always activate, don't you want to check to make sure that the sum is equal to some number? Giggity Link to comment Share on other sites More sharing options...
clasher Posted February 2, 2009 Author Share Posted February 2, 2009 Hımm first function is called in a previous function and after that previous function resolves these options need to be resolved too. So there need to be some change in 1 of these :S And I cant understand your second sentence:( Link to comment Share on other sites More sharing options...
jvanegmond Posted February 2, 2009 Share Posted February 2, 2009 Maybe some ideas that might help you: Instead of using functions. Give you program a ( number index ) state it is in. Based on the state it knows what to do, and each state can determine for itself what state to go to next. Code example with 2 states that just keep going back: $state = 1 while 1 if ( $state = 1 ) then $state = 2 else $state = 1 end wend github.com/jvanegmond Link to comment Share on other sites More sharing options...
clasher Posted February 2, 2009 Author Share Posted February 2, 2009 But in a command that you have I cant enter checksum issue for searching any changes in any place cause it is an infinite recursive:(. If I call first checksum in somewhere it wont resolve until that part is changed:( Link to comment Share on other sites More sharing options...
jvanegmond Posted February 2, 2009 Share Posted February 2, 2009 (edited) You need to lose the idea of a "function ring", because that gives infinite recursion problems in AutoIt.Fortunately, you never need it in programming either. Everyone just uses loops.$buyCheckPrev = PixelChecksum(1100, 60, 1260, 480) $sellCheckPrev = PixelChecksum(630, 600, 640, 615) $withdrawCheckPrev = PixelChecksum(560,370, 570, 380) $buyCheck = $buyCheckPrev $sellCheck = $sellCheckPrev $withdrawCheck = $withdrawCheckPrev while (true) _getchecks() _comparechecks() wend func _getchecks() $buyCheck = PixelChecksum(1100, 60, 1260, 480) $sellCheck = PixelChecksum(630, 600, 640, 615) $withdrawCheck = PixelChecksum(560,370, 570, 380) endfunc func _comparechecks() if ($buyCheck <> $buyCheckPrev ) Then $buyCheckPrev = $buyCheck msgbox(0," ", "buying mode") endif ; and add things for the other codes endfuncEdit: Notepad bad editor. Edited February 3, 2009 by Manadar github.com/jvanegmond 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