Added the ability to set field colors based on values
I added in the load script
vtimer=0
used to only update colors every 30 PLC loops
function GetPoundDroVariables()
local inst = mc.mcGetInstance();
for i = 0, 999 do
local val = scr.GetProperty('drovar'..tostring(i),'Value','Value',0);
scr.SetProperty('drovar'..tostring(i), 'Fg Color', 'Black');
if val == '' then
val = tonumber(0)
else
val = tonumber(val)
if val > 0 then
scr.SetProperty('drovar'..tostring(i), 'Fg Color', 'Blue');
elseif val < 0 and val > -99999 then
scr.SetProperty('drovar'..tostring(i), 'Fg Color', 'Red');
end
end
end
end
vtimer = vtimer + 1;
if vtimer == 30 then
vtimer = 0
GetPoundDroVariables();
end