triggering events from the timeline

i am completely new to touchdesigner (a couple of days new) and am currently working my way through the tutorials and guides online, but one thing im failing to see (which i would have expected to see by now) is how to trigger events when the timeline hits a certain point.

the way i understand it is that touchdesigner does not focus on a timeline method like most video editors do, but on an information input method, but there must be a simple way to reference the timeline so that once it hits a certain point an event happens.

i have worked my way through the first noob tutorial videos and i am working my way through some other videos too and still havent seen this. is there a guide on how to do this somewhere? or can somebody please explain it?

thank you

1 Like

Not many people use the timeline in production. What are you trying to do that you’d like to use the timeline for? There may be a more TouchDesigner-friendly way of doing that same thing.

The timer chop might fit your needs.
Try looking at Help->Operator Snippets, timer chop, example 7. You could extend the example by selecting the message row of the info dat. Have a dat execute look at the selected row for when the table changes. That will allow you to execute a script every time the table changes.

Calvin

make a constant CHOP and write an Tscript expression:

if($F == 10, 1,0)
where 10 = your frame

thanks for the replies everybody.

i am more investigating out of curiosity at this stage, however i do see a lot of my future needs relying on a timeline.

i didn’t know those snippets were there, they’re great! i’m going to examine those closely.
i see what that example is saying, and the description does seem to be what i’m looking for, but mine doesnt seem to work :confused: it stays at “revving up” if the timeline is playing back or not. i assume those values are seconds? i ran it for 20 seconds.

for some reason this returns an error saying:

Error: (Parameter: value0) if($F == 10, 1,0)
^
SyntaxError: invalid syntax

Substitute Python expression ‘me.time.frame’ for Tscript variable ‘$F’ or switch to Tscript. (/project1/constant1)

thanks

i just discovered the timeline chop, which i think i can use to fire 1frame long pulses and even use to control ranges. i havent tried it yet though

For this issue, in the top right corner of the operator parameters is a little blue and yellow Python logo, if you click it, it’ll turn into a “T” which means the operator is in Tscript mode and will except things like $F and the expression above.

Timer CHOP would be reliable and easy thing to get frame numbers from and use that as your “timeline”. Also, you can create a local time component instead of hooking onto the master one, I’m not sure if there are any good examples of that around, worth doing a search for. I generally go the Timer CHOP route.

ah! amazing, thank you so much!
im sure that is going to be the best and simplest way by far to trigger a pulse.

would there be any benefit to using the timer chop over the timeline chop? other than for the options such as changing timing e.t.c.?

As a side note, usually it’s never good to check exact frame numbers to trigger an action. Place a hog chop in to simulate dropping frames, and that expression might never evaluate to true, unless the realtime flag is off.

Regarding the timer chop, for that particular example I mentioned, to start it you would need to click to click the timer7 start button.

i was just building on the idea then realised that it wasn’t always firing, then i noticed my true frame rate was much lower than my set rate. i came here to ask if that was why and you had already mentioned it :smiley:

i found that setting the == part of the code to >= sorted the problem, but this means i will need to process further if i need the pulse to return to zero, which is not a problem, i can use a trigger to hold the value for 1 frame.

as for the timer example. now i see how it works :slight_smile: and i can easily adjust these values to use the timeline by changing the timers play mode to “lock to timeline”.

thank you so much for the help

Generally it is best to avoid running any sort of python evaluation every frame - ie. checking for specific frames or conditions, operator references, etc. Rather, it is best to try to either script what is necessary on startup of sequence - or be CHOPing - as CHOPS are quite fast in relation to python. On small networks these performance benefits will be somewhat insignificant, but as you begin to program large networks these will mostly be your first step towards optimization.

In regards to the timeline - be careful with local timelines as they can become somewhat hairy to keep inline with your the master timeline and can produce unexpected results. I even avoid using the master timeline and prefer keeping my ‘timeline’ isolated in a Timer CHOP or a Speed CHOP. These give you precise control over triggering events as well as easy ability to ‘fork’ out and control your entire network.

One method I often use for triggering sequences is a Speed CHOP → Logic CHOP set to ‘Off When Outside Bounds’ - this will produce a 1 when the speed value is inside the set boundaries and a 0 when outside the set boundaries. This is much quicker than python evaluation and is easy to CHOP out across the network. Likewise, you don’t run the risk of non-evaluation if you skip a frame.

Attached is a super simple example using a Speed CHOP → Logic CHOP to fork out control to the network.
speed_logic_trigger.tox (1.43 KB)

1 Like

On advantage is that you don’t have to wrestle with the Timeline (playbar and component time etc) to control it if you use a Timer CHOP, you can control it free form and start and stop its playback at any time. Besides that the Timer CHOP has dozens of things to monitor and fire off triggers (including python callbacks) whereas using the Timeline CHOP is just bareones and you’ll need to build all this triggering action yourself.

I would use the Timer CHOP wherever I can over the Timeline CHOP right now.

thanks guys! some great information here. thank you all so much for the help