Run a shared script on a tag event?

I just have a question,
I have a hunch that this is not possible, but I am going to ask anyways.
Can I run a shared script on a tag event? Because what I am trying is not working so far.

Yes, you can call a global script from a tag value change event script. I noticed your global script was changed but not saved (italics in module name). Could you try saving and then testing again?

1 Like

Thank you.
Now, I saved it and test it again but when I toggle the tag, it show red indicating the script is not executing.

I test this function script on the Script console, but it only works for me on the Script console so far :confused:

Right click on the tag showing the red error and choose Diagnostics.
Then drill down into the tree until you get to the error.

A lot of functions work differently in gateway scope, especially anything that depends on project defaults. Tag Events aren't in a project, so everything must be declared. All of your tag paths must have the bracketed provider name or one of the provider shortcuts, as one example.

2 Likes

You are correct. Thank you very much.
On a expression tag this worked:

runScript("shared.Write.BuildIns",0,"[default]R3_03_S1/Ins","[default]R3_03_S1/Arg","[default]R3_03_S2/Desc","[default]MX_Seating/R1Cx_01B/CriticalsX")

On a tag event:

	if currentValue.value == 1:
		shared.Write.BuildIns("[default]R3_03_S1/Ins","[default]R3_03_S1/Arg","[default]R3_03_S2/Desc","[default]MX_Seating/R1Cx_01B/CriticalsX")
	else:
		pass