you create the registers in the plugins and then you can view the current status in the diagnostic register section
this is a function i wrote to get the data out of the ini file
but this give you an idea of how you need to read a dro value, and set the registers values
the trick is to use the "mcCntlSetLastError" as a debugging tool to view in the history box what is happening.
so this function would be called from the load script then i have another function to keep the registers current that runs in the plc script.
Or you can create a button and under the button call the SetPartCount() function to test.
you dont have to be this elaborate to start with but the you still need to go through the whole process for each DRO, button and register to beable to read, write and control them. Name your controls and be consistent "drovar3901" as in this example i know that its a dro and 3901 is a fanuc variable that is used for holding the part count.
function SetPartCount()
local inst = mc.mcGetInstance();
--("iRegs0/Parts");
local partsCounter = mc.mcProfileGetInt(inst , 'drovar3901' , "3901", val);
mc.mcCntlSetPoundVar(inst, 3901, partsCounter)
--("iRegs0/Required");
local partsRequired = mc.mcProfileGetInt(inst , 'drovar3902' , "3902", val);
mc.mcCntlSetPoundVar(inst, 3902, partsRequired)
scr.SetProperty('drovar3901', 'Value', tostring(partsCounter));
scr.SetProperty('drovar3902', 'Value', tostring(partsRequired));
local hReg = mc.mcRegGetHandle(inst, 'iRegs0/Parts');
mc.mcRegSetValue(hReg, partsCounter);
local hReg = mc.mcRegGetHandle(inst, 'iRegs0/Required');
mc.mcRegSetValue(hReg, partsRequired);
--mc.mcCntlSetLastError(inst, 'partsCounter = ' .. tostring(partsCounter));
--mc.mcCntlSetLastError(inst, 'partsRequired = ' .. tostring(partsRequired));
end