Having a toggle ‘remember’ a previous state

mauricenorris's icon

I’m currently using one [live.toggle] to enable another.  So when Toggle 1 is turned on, it also turns on Toggle 2. However, what I want to do ultimately is this…

If Toggle 2 was previously in an 'off' state (before being turned on by Toggle 1), I want it to turn back off again when Toggle 1 is turned off. If it was previously in an 'on' state, I want it to remain on when Toggle 1 is turned off.

I can’t help feeling I’m missing something basic here, but it’s been driving me mad for days!

I’ve been looking at possibly using [col] or [dict] to store all previous states of Toggle 2, then looking one step back in the sequence to find its previous state. I’m wondering though if there’s a simpler way of doing this, or if there’s a specific object (or setting within [live.toggle] itself) that I could use for this sort of thing? Or should I continue on the [col] / [dict] path for this?

Cheers! :)

TFL's icon

A combination of [trigger], [gate] and [i] (to store the previous state) should be enough:

Max Patch
Copy patch and select New From Clipboard in Max.

mauricenorris's icon

Thankyou!!! Yes, this is exactly what I was looking for.

I just couldn't get my head around the logic, but this really helps. :)