You can access any register in Mach4. You can do it in the PMC or you can do it in LUA.
if you have the regfile plugin enabled in Mach4, goto Diagnostic->Regfile and navigate to ESS->Encoders->Encoder_#, 'right-click' the register and select copy path to clipboard. Then you can get the register handle and the value.
mc.mcRegGetHandle(inst, 'path/you/just/copied') -- the path should be in between quotes
ScreenLoad Script:
local essEncoder0Reg = mc.mcRegGetHandle(inst, 'ESS/Encoders/Encoder_0')
PLC Script:
local essEncoder0Val = mc.mcRegGetValue(essEncoder0Reg)
mc.mcCntlSetLastError(inst, tostring(essEncoder0Val))