I found that for me Registers are very useful.
•   How to turn on Registers.
Go to Configure, Control, Plugins tab then place a green check next to Regfile.
•   How to make a new Register.
Go to Configure, Plugins then Regfile.
Click on the green plus sign.
   Give the register a name. (no spaces)
   Give the register a starting value.
   Put in a longer description.
   Persistant
      A green check will keep value on exit from Mach4.
      A red x will start every new start of Mach4 with the starting value.
•   How to read a Register.
local variable = mc.mcRegGetHandle(inst, ‘path’)
local variable2 = mc.mcRegGetValue(variable)
   Examples:
local hreg = mc.mcRegGetHandle(inst, ‘Encoder_0’)
local EncRawVal = mc.mcRegGetValue(hreg)
or
local hreg = mc.mcRegGetHandle(inst, ‘ESS/EncRaw’)
local EncRawVal = mc.mcRegGetValue(hreg)
or
local hreg = mc.mcRegGetHandle(inst, ‘iRegs0/NotchTime’)
local EncRawVal = mc.mcRegGetValue(hreg)
•   How to write to a Register. (this might be wrong)
local variable = mc.mcRegGetHandle(inst, ‘path’)
local mc.mcRegSetValue(variable, value)
or
local variable = mc.mcRegGetHandle(inst, ‘path’)
local mc.mcRegSetValue(variable, tostring(value))
   Example:
local hreg = mc.mcRegGetHandle(inst, ‘ESS/EncRaw’)
local mc.mcRegSetValue(hreg, 23.35)
   or
local Num = 23.35
local hreg = mc.mcRegGetHandle(inst, ‘ESS/EncRaw’)
local mc.mcRegSetValue(hreg, tostring(Num))