Page 1 of 1

Action on evert n-th event

Posted: Tuesday 11 August, 2015 - 16:28
by EvelineHermans
Hi,

I am wondering if it is possible to simplify my code. I want to regulary close two inputchannels, to which I already made a reference. At every 150th output, I want to shortly open these two inputchannels. Now I write the code for the 150th and 300th output separately, but as I want to generate thousands of products, I assume this is not the most simple way to write my 4DScript.

The script I use now is:

Code: Select all

Do(
 If(
 output(c)=150,OpenInput(refAtom1),CloseInput(refAtom1)
 ),
 If(
 output(c)=150,OpenInput(refAtom2),CloseInput(refAtom2)
 ),
 If(
 output(c)=300,OpenInput(refAtom1),CloseInput(refAtom1)
 ),
 If(
 output(c)=300,OpenInput(refAtom2),CloseInput(refAtom2)
 )  
 )
Is there someone who can help me out :)?

Thanks!

Eveline

Re: Action on evert n-th event

Posted: Tuesday 11 August, 2015 - 16:38
by EvelineHermans
I was too fast in asking.. sorry.
I found the answer already in one of the predefined functions in another atom :)

Code: Select all

mod(output(c),150)