Inrange

From EventScripts Community Encyclopedia


Overview

Syntax: inrange <variable> <value1> <range> <value2>

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: {{{x}}}

Description

Checks to see if <value1> is within +-<range> of <value2> and outputs 1 if true, or 0 if false, to <variable>.

Parameters

  • variable - This is the return variable for the result. 1 if true, 0 if false
  • value1 - This is the number you want to check the range on.
  • range - This is the allowable range to check for value1.
  • value2 - This is the number that value1 must be within range of.


Examples

es_xsetinfo myvar 0
 
// Check to see if 10 is within +-5 of 15.
inrange myvar 10 5 15 //myvar = 1
 
// Check to see if 10 is within +- 3 of 6.
inrange myvar 10 3 6 //myvar = 0
 
// Check to see if value1 is within 10 of value2.
es_xset value1 85
es_xset value2 100
es inrange myvar server_var(value1) 10 server_var(value2) //myvar = 0 


Notes

  • This command does not expand variables!
  • Requires Eventscripts 1.5+


See also

External links

inrange

{{{category}}}

blog comments powered by Disqus