ViciouS 0 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 ? Share this post Link to post Share on other sites
somdcomputerguy 103 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. Share this post Link to post Share on other sites
Malkey 231 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. Share this post Link to post Share on other sites
smartee 14 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 Share this post Link to post Share on other sites
ViciouS 0 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. Share this post Link to post Share on other sites
ProgAndy 88 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 Share this post Link to post Share on other sites