Jump to content

Plus Or Minus Symbol?


Recommended Posts

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

"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

If you have a great number of conditions based upon the plus or minus operation maybe you can make a function like this

Func 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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...