Iteration

I’m trying to find a way of iterating through a spread. I have an output boolean that will periodically change to 1. When this occurs, I’d like to ++ my iterator var so I can then use getSlice. It seems like maybe I need the automata patch, but am finding it difficult to decipher the syntax…

first rule of thumb is that in 99% of all situations there is no need for iterating, as there is a node for getting the result immediately.

apart from that use Counter (Animation) or a loop with + and FrameDelay (Animation) . perhaps throw in a MOD (Value) if necessary.

Automata (Animation) is cool but wont help you with numbers.

Got you. It’s not really a programmatical iteration that I need, just a way of cycling through file-paths when another variable changes. I’ll have a play with the nodes you mentioned. Many thanks…

Maybe I’m being dense here, but these all seem to iterate at the frame rate. I just want a way of increasing a value by one every time x goes over y. Apologies if this is elementary stuff. I’m still finding my way with vvvv a little. Is there a way of stopping the counter after every count?

For example:

float x;
float y;
integer i;
integer maxVal =5;

if (x>= y) {
i ++;

if(i>maxVal){
i = 0;
}
}

connect the boolean to a TogEdge, and this to the Up pin of a counter. :-) that should do it (although i can’t check right now)

Perfect! Thanks a lot

Hmm,

That works just as I’d hoped, except I don’t seem to be able to connect the output of counter to the index of getSlice(String). They both appear to be integers. What am I missing?

maybe creating feedback loops?