Here are a few examples that may help show the consequences of #focused. Assume that track 1 is Active (white border) and tracks 2 and 3 have Focus Lock enabled.
Mute
This will send Mute to track 1 only. I'll explain why this is the default in a minute.
in focused Mute
This will send Mute to tracks 1, 2, and 3.
#focused
Mute
This will send Mute to tracks 1, 2, and 3. The difference between this and the previous example is that there are actually three copies of the script running. Each script is only sending to one track, but there are 3 of them pointed to different tracks.
Most of the time you can get the same behavior you get from #focused just by wrapping this around your script:
in focused {
...whatever the script does...
}
This results in slightly less overhead since we're not needing to create and manage three different instances of the script. But that overhead usually isn't noticeable.
The reason #focused is not on by default is this:
LoadSnapshot("someName")
LoadSnapshot is not a track-specific function. It reads potentially many files and does a lot of work in mrmory, then distributes the results to the tracks. If you did this:
#focused
LoadSnapshot("someName")
You would end up loading the snapshot 3 times, twice redundantly. It is because scripts can always contain a mixture of global and track-specific functions that the default is not to be #focused.
There is one case where using #focused would normally be required, it is any script that uses a wait. Consider this:
in 1,2,3 {wait loop Mute}
in is an iterator. It loops over the tracks in the list and does the things inside the {} block for each track. The first thing is "wait loop" which means to wait until the playback of this loop reaches the end. Then when that finishes, it does Mute. The important thing here is that track 2 won't be processed until track 1 finishes. While we're doing that "wait loop" for track 1, track 2 is still alive and moving, and it may have actually reached it's end first. When we finish with track 1 and move to track 2, we'll wait again before moving on to track 3, and and on. in works sequentially or in series not in parallel.
What you usually want in this situation is to have independent "wait loop"s for each of the tracks so they
Mute as soon as they reach their endpoint without waiting for any of the other tracks. To do that
you have to use what programmers think of as concurrent threads. And that is essentially what #focused does:
#focused
wait loop Mute
Note though that the decision about which tracks to do this to has moved out of the script and into
the binding using Focus Lock or Groups. There is currently no way to start parallel threads inside a script,
it has to be done from the outside with binding replication. There will be ways to address this in the future.