Tag events, gateway events, library scripts

Never do this... there are only 3, iirc, threads for tag event scripts. Tag even scripts must execute sub 10ms so that it doesn't cause issues with other parts of the system.

This is the way to do things like this. Write a project library script do the actual data logging, and call it in the Gateway even script as a single line.

This isn't like the others. The reason for doing a project library script isn't speed, it's code scoping. I don't fully understand it, but I've learned that sometimes scripts in tag events don't understand certain internal functions unless you import them. This can be mitigated by calling out to a project library script where the scope is proper.

So to give you the full answer, use a gateway even script that calls a project library script. This will help you avoid any potential scoping issues, plus when you need to troubleshoot, it's easier to do a single call in the script console rather than reproducing all the logic every time.

1 Like