Hi there. I’m new to Touchdesigner so some things I know how to program but not how I would specify this in TouchDesigner.
I find myself wanting to use an if statement, is this possible in touch designer? I have a count which counts from 1 to 7. I would like to link this to 7 separate null nodes which each hold a value of 0 and 1.
When count is on each nodes representative number the null node should contain a value of 1 signalling it is on, if it is not being referenced then it should show 0 representing it is off.
Could someone give me a simple example of an if statement working on values of nodes within a system? If I had this i’m sure id be able to work it out myself but they’re arent any on the wiki
Thanks for replying, but i’ve read this back to front now. I just asked because i’ve been through most of the tutorials and none of them seem to have discussed Tscript at length or given examples of using data within nodes.
If ive overlooked anything please feel free to correct me
Ah! This is how count is used! I knew there must have been a simpler way! I remember being confused because the left input on the node says “channels to count” so i put in a math chop with the corresponding numbers. I just put a simple square wave in on the left as I want it to play automatically and it goes through them fine.
I had no idea you could use count as kind of an opposite to the switch by connecting more than one node on the right. This should be made clearer in the wiki.
sorry about reviving a very old thread, but here is an updated version with python instead of tscript in the examples in case anyone needs it in the future.
another good operator to look at for this is the Fan CHOP. It will take channels with index values as input and set the channel of the input index to 1. So if the input value is 1, then the second channel in the Fan CHOP will be set to 1 (TouchDesigner is zero based)