## Knowing when a number is within range of a randomly changing number

Aug 05 2013 | 1:46 pm
Hi
This might seem straight forward to some people but I am having difficulty even explaining what I am trying to achieve never mind producing a system that does it.
Is there a way to understand when a number is within a range of e.g 20 less or 20 more or equal to the random numbers?
I looked at the help file for 'compare' and they use a system similar to what I am trying to achieve but you can't choose to say if the number is e.g either equal or close enough to equal by about 20 either
So anything further away than the number by 20 is toggle off, in the range is toggle on.
This is what I have so far...

• Aug 05 2013 | 2:05 pm
Do you mean something like this?
• Aug 05 2013 | 2:36 pm
Yeah that's the ticket!
I have made some more changes to it with regards to it resetting the system after its banged, but yeah its working pretty good now. Thanks for the help dude
• Aug 05 2013 | 4:15 pm
[expr (\$i1>=\$i2)&&(\$i1=\$i2)&&(\$i4
[if (\$i1>=\$i2)+(\$i1=\$i2)+(\$i4
-110
• Aug 06 2013 | 12:30 pm
Cheers for that Roman. Think I will stick with this method for now just so I can visually see what is going on.
Here is the updated version
There are some changes to make the blue boxes decimals, which meant the range of those boxes needed to be altered to reflect the decimals & negative values
• Aug 17 2013 | 6:26 pm
Hi guys,
sorry to have to bring this thread back up but I have encountered a problem with an updated version of the system which I can not figure out.
Basically where the -50 and + 50 are I am trying to make it so that these numbers change over time too. So the scale object works out the number fine, but is there a way of transferring those numbers that are changing over time in the number of - 50 and + 50. So the range would change?
I hope that makes sense, here is what I have so far
• Aug 18 2013 | 10:16 am
I don't know if I understood correctly... but I guess the numbers you get with [scale] are the width of your range, aren't they? So, if you want to "center" that range, you just have to divide them by two and send them in the right inlet of the [- ] and [+ ] operators.
• Aug 18 2013 | 1:40 pm
Hey
Those changes don't seem to work unfortunately. I am trying to acknowledge (via toggle on) if the right red number box and the right blue number box are 'in range' with the number in both the left red box and the left blue box.
But the 'range' is changing over time. I tried deleting the 50 and directly sending the range number into the right inlet of the '-' and '+' but that still doesn't seem to work.
See below - it's not understanding the if in range or not
• Aug 18 2013 | 2:59 pm
Ok, the matter is that almost every Max object has only one "hot" inlet (usually the left one), so if you want the "range" changes to be visible, you'll need to retrigger the red and blue boxes everytime the range values change.
• Aug 18 2013 | 4:37 pm
Okay, thanks for clearing that up. I wasn't aware the numbers needed to be re-triggered
All the best
• Aug 20 2013 | 7:19 pm
Sorry to bring this up again, but there are still some issues.
The issue is that it understands when the right numbers are within range or under the left numbers, however it is not recognising when it is over the range.
If the right number goes over 100 + range it isnt turning off
Hope this makes sense its driving me up the wall
• Aug 21 2013 | 12:48 pm
I seem to have fixed the issue regarding the range now, I think the problem was the left blue and right number was not connected to the - and + left inlet. Seems to work now anyway. However, if you noticed the system at the bottom which bangs when both the red and blue are in range is not working. It seems to bang when the red enters the range even though the blue isnt.
I thought the &&, sel 1 would sort that but its not working. So any ideas regarding that would be great
j
• Aug 22 2013 | 11:43 am
Hey, Would all of that not be a lot simpler with the [split] object ?
• Aug 27 2013 | 2:22 pm
Alright dude, yeah that seems a much simpler method of getting around it
Take a look at this update, it just means I can change the range as opposed to it being set to + 20 & - 20
Just need to check the decimal version works now
All the best
• Aug 27 2013 | 2:37 pm
Decimal version : u probably just need to set a floating point as default to the split
• Aug 27 2013 | 2:37 pm
There is a problem with the decimal version
it is not acknowledging the + & -
• Aug 27 2013 | 2:40 pm
sorry I posted that without refreshing the page. Yeah you are right, it works great now
thanks for all the help