I can write to a client memory tag from a client timer script, but not from the value-changed script for a tag.
Scenario:
A fresh install of Ignition 7.9.5, with one simple project.
A client timer script executes at 2 second intervals. (Was 1 second intervals for a while.)
The timer script:
-- Increments GenericSimulator.WriteableInteger1, so I know the timer script is running.
-- Toggles GenericSimulator.WriteableBoolean1.
-- Optionally toggles client string tag Info.
The write to the Info tag always succeeds.
The value-changed script in GenericSimulator.WriteableBoolean1:
-- Toggles GenericSimulator.WriteableBoolean2, so I know the WriteableBoolean1 script is running.
-- Optionally toggles client string tag Info.
The write to the Info tag never succeeds. There is no mention of the write in the wrapper log.
It is the same line of code in the two scripts.
I use GenericSimulator.WriteableInteger2 to determine which script writes to the Info tag, so there is no contention. (I also ran the test by alternately disabling the scripts, with unconditional writes; same result.)
Why would the same line of code work in the client timer script, and fail in the tag value-changed script?
Separately, and seemingly unrelated, the wrapper log has this entry at one second intervals:
-- Created auto-backup of internal database "config.idb" in 893 ms
This is the code in the timer script:
iValue1 = system.tag.read('WriteableInteger1').value
system.tag.write('WriteableInteger1', iValue1 + 1)
iValue2 = system.tag.read('WriteableInteger2').value
if system.tag.read("WriteableBoolean1").value:
system.tag.write("WriteableBoolean1", False)
if iValue2 == 1:
system.tag.write("[Client]Status/Info", "False")
else:
system.tag.write("WriteableBoolean1", True)
if iValue2 == 1:
system.tag.write("[Client]Status/Info", "True")
This is the code in the value-changed script for GenericSimulator.WriteableBoolean1:
iValue2 = system.tag.read('WriteableInteger2').value
if currentValue.value:
system.tag.write("WriteableBoolean2", True)
if iValue2 == 0:
system.tag.write("[Client]Status/Info", "True")
else:
system.tag.write("WriteableBoolean2", False)
if iValue2 == 0:
system.tag.write("[Client]Status/Info", "False")