Recent topics
Recent Comments 
Logic patch macroCan anybody assist me with a dilemma Im having, I need to hold a value and only send it if a true value is present. Currently the only way I know how to do this is embed the value within a macro patch consumer but that kills the output.

i use the multiplexor for this. seeing that true = 1 and false = 0 it works well in the index context of a multiplexor. follow me to only send if true. well put what ever your getting your t/f values from as the index to a multiplexor. the value on source index one is the value that you want for true and the value of source index 0 is the value of what is to happen if false. its kind of like a switch but works well in a logic context or i use it in combination with the logic patch and the conditional patch all the time.
there is also the sample and hold patches as well as the queue patches that can hold values for you until you need them as well as java script.
Do it how Dust is saying or use JS. If you are more specific about the input and output states it's easy enough to do with a couple of lines of Javascript. As it stands request is a bit ambiguous.
this is troubling me as well. I'm trying to sample a number I am calculating every 15 seconds, divide it by 4 (it's kCAL/min), round it, and add it to an incremental total. I used an INTEGRATOR but it seems to really add up fast, and doesn't seem right.
Its driving me nuts because it seems there should be some sort of simple rounding function that doesn't go to a whole number too  the numbers from the calculation are like 0.04293929
I tried that multiplexer thing with triggers and other stuff but its not working.
Try the attached method for the kind of rounding/truncating you are talking about... you basically want to multiply by some factor of 10, then do your rounding. After that, divide by the same amount.
Do you have the part of sampling it when you need to, then doing necessary math worked out?
sorry to cross=post. here is the link to a thread i started with the qc fie attached
What George says is correct for rounding to n decimal place.
There is the further problem of numbers, even when being rounded to n dp, can drop digits off because of rounding — zeros don't get put into the string — either side of the decimal place ie at start or end of number.
So where x is in range [09999], x=0023.9999 at 2 dp becomes x_as_string = "24"
This can create formatting problems when the number is in a string of rapidly changing numbers, the text jitters around even with monospaced numeral glyphs. As discussed a while ago on another thread.
I've known the number formatting patch has to be the answer, so I finally got around to deciphering the codology in the settings inspector. Unfortunately being settings (not an input), it's set and forget. This means the patch can't be set dynamically by other patches that respond to a context (like number range) but it saves a whole bunch of math and string patches that would be needed to do this otherwise.
Anyway, the picture tells a thousand words (to 4 decimal places hahah) so just look at the comp I've attached.
i was more or less saying that a multiplexor can be used to toggle states if your only using two inputs. i do this all the time. lets say i want i want to trigger something false when i input a truth. i set a multiplexor to type boolean and set the 0 input to true and 1 input to false, so lets say your using a time patch with a conditional if at 10 seconds you want to turn off something but also turn something on.
you set the conditional patch to evaluate true at greater than equal to 10. you send the truth value from the conditional to what you want to turn on and then also send that same truth value from the conditional to the multiplexor with boolean false on index 1 so the conditional turns something off and on at the same time.
maybe i didn't explain myself so well. maybe my logic is a bit fuzzy ;)
i find javascript is easier if you want to evaluate multiple conditions at once. for instance evaluating if (x is not equal to y and y is greater than two or y is less than x){ then print x }else {print y} this of course can be done with the logic operator patch and multiple conditional patches but some times things like multiple conditionals outputting variable indexes always seems faster in java script. checking a few conditionals with and or xor etc... is easy enough.
if anybody is into logic. this is a law i made up. like the laws of boolean we use in qc this is the same but for negation and implication.
¬(p=>q)=>(pvq) <=> ¬(pvq)=>(p=>q)
both sides equate to absolute truth or a tautology. if your ever on a quest to discover absolute truth this is a good equation to look at. thats the nice thing about logic it can offer absolute truth.
here is a simple example of how to store a number. you can use the above mentioned conditional logic to do what you want with the stored number.
The easiest way to return a false when you have a true (or vice versa), is to get a math patch and use the expression:
!x
....which is "not x" in boolean logic.
wow that looks awesome. I'm trying to deal with some other problems issuing terminal commands from QC, but your solution looks very clean. I hope I can implement it.