Convert existing vars to hash...
Code:
  var %i = 1
  ; find all matching vars
  while $var(%me*,%i) {
    ; hadd them (you can remove the -m switch, it only makes sure the hash table is open.
    ; - $mid($v1,2) removes the first char from the varname (the "%") 
    ; - $($v1,2) is the vars value
    hadd -m tablename $mid($v1,2) $($v1,2)
    inc %i
  }
  unset %me*


On dialog events...
Code:
on *:DIALOG:ME:sclick:*:{
  hadd -m Tablename ME104 $iif($did(104).state == 1,ON,OFF)
 ...
}
on *:DIALOG:ME:INIT:0: {
  if $hget(tablename,ME104) == On { did -c ME 104 }
 ...
}