Rework how scripts work.

Introduce a active component chain. This chain starts at the root and
ends at the last component with state >= 0.