From layout mode, you can right-click on the Scene thumbnail in the "Scene manager" and click on "Edit Script Events...".
Copy/paste the script into the appropriate script (in the case both OnOnline, and OnPreviewRender). You need to then click the lightning bolt or press F7 to compile BOTH scripts. You'll either get errors at the bottom, or it will compile and the red X becomes a green checkmark. You need to recompile anytime the script is edited.
To see the effect of the scripts, you should flip to sequence mode and you can edit the template data to see the preview with the script applied.
#XPression