<triggers>
  <trigger
   enabled="y"
   group="TimeCalc"
   keep_evaluating="y"
   match="^\d+h(?:, \d+m)?(?:, \d+e)?(?:, \d+w)? ([@cexkdb]*)(?: Vote)?-$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
  -- put the captured cexkdb flags in a variable
  local flags = "%1"
  -- make a table to tuck away our variables in
  if not timecalc then timecalc = {} end
  -- check if we have eq/balance and set the variables for them
  timecalc.equilibrium = not(string.match(flags, "e") == nil)
  timecalc.balance = not(string.match(flags, "x") == nil)  
  -- check if we lost eq/balance and record the time
  if not timecalc.equilibrium and not timecalc.receq then
    timecalc.eq_time = GetInfo(232)
    timecalc.receq = true
  end
  if not timecalc.balance and not timecalc.recbal then
    timecalc.bal_time = GetInfo(232)
    timecalc.recbal = true
  end
  -- the timecalc.receq and timecalc.recbal are there so we don't re-record
  -- the time over and over if we get spammed with multiple prompts
  </send>
  </trigger>
  <trigger
   enabled="y"
   group="TimeCalc"
   keep_evaluating="y"
   match="^You have recovered balance on all limbs\.$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
  -- if the timecalc table doesn't exist no point in continuing
  if not timecalc then 
    ColourNote("lightgray", "", "%0")
    return 
  end
  -- Whoo! We got balance, lets see how long that took
  local timediff = GetInfo(232) - timecalc.bal_time
  local timediff = math.floor(100*timediff+0.5)/100
  ColourNote("lightgray", "", "%0 -&gt; " .. timediff .. " seconds")
  timecalc.recbal = false
  </send>
  </trigger>
  <trigger
   enabled="y"
   group="TimeCalc"
   keep_evaluating="y"
   match="^You have recovered equilibrium\.$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
  -- if the timecalc table doesn't exist no point in continuing
  if not timecalc then 
    ColourNote("lightgray", "", "%0")
    return 
  end
  -- Whoo! We got equilibrium, lets see how long that took
  local timediff = GetInfo(232) - timecalc.eq_time
  local timediff = math.floor(100*timediff+0.5)/100
  ColourNote("lightgray", "", "%0 -&gt; " .. timediff .. " seconds")
  timecalc.receq = false
  </send>
  </trigger>
</triggers>