ViciouS Posted April 9, 2011 Share Posted April 9, 2011 I need some help figuring this out.... im trying to find a way to check If $MePos[0] = 5663 'plus/minus 10' Then do something endif will i have to do something like..... If $MePos[0] <= 5668 And $MePos[0] >= 5658 then ? Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 9, 2011 Share Posted April 9, 2011 I believe this will do it for you, Switch...Case. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Malkey Posted April 10, 2011 Share Posted April 10, 2011 "If $MePos[0] <= 5668 And $MePos[0] >= 5658 then " will give 5663 plus or minus 5. Use "If $MePos[0] >= 5653 And $MePos[0] <= 5673 then " to achieve 5663 plus or minus 10. And using the convention of traveling from left to right along the number line, the lower number is on the left and the greater number is on the right when expanding to the limits of the plus or minus exercise. Link to comment Share on other sites More sharing options...
smartee Posted April 10, 2011 Share Posted April 10, 2011 If you have a great number of conditions based upon the plus or minus operation maybe you can make a function like thisFunc PlusOrMinus($number, $test, $range) If ($number >= ($test - $range)) And ($number <= ($test + $range)) Then Return True Else Return False EndIf EndFunc ;==>PlusOrMinus ;Example call If PlusOrMinus(60, 50, 10) Then MsgBox(64, "Info", "60 is within 50 +/- 10") EndIf Link to comment Share on other sites More sharing options...
ViciouS Posted April 10, 2011 Author Share Posted April 10, 2011 for what i need it to do, i think smartee's idea works best.im calling it alot. this is what i was working with If $Pos[0] <= $XPlus And $Pos[0] >= $XMinus And $Pos[1] <= $YPlus And $Pos[1] >= $YMinus = true Then i was hoping for some sort of symbol or built in function but thatll do. thx. Link to comment Share on other sites More sharing options...
ProgAndy Posted April 10, 2011 Share Posted April 10, 2011 This is another way: $value = 1234 $test = 1200 $range = 20 If Abs($value-$test) > $range Then MsgBox(0, '', $value & " is not between " & $test-$range & " and " & $test+$range & " (incl.)") EndIf *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes 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