

;-------------> ALIAS DDL <---------------;
alias mdx { var %dll $mircdirAddons\dll\mdx\mdx.dll } | return $dll(%dll,$1,$2-) }
alias dialogx { return $mircAddons\dll\mdx\dialog.mdx }
alias mdxbegin { mdx SetMircVersion $version | mdx MarkDialog $dname }
;----------------------------;
alias split { dialog -m nsplit nsplit }

dialog nsplit {
  title "Netsplit Detector"
  size -1 -1 80 60
  option dbu
  radio "Attiva", 1, 6 9 25 10,
  radio "Disat.",2, 47 9 34 10
  check "Al Chan",3,47 33 30 10 
  check "A te",4, 6 33 20 10  
  button "OK", 5, 2 47 38 12, ok
  button "Annulla",6,40 47 38 12,cancel
  box "Attivazione",7,2 2 76 20
  box "Mostra messaggio",8,2 25 76 20

}

on 1:DIALOG:nsplit:init:*: { 
  if (%split = on) { did -c  nsplit 1 }
  if (%split = off) { did -c nsplit 2 }
  if (%me.split = on) { did -c nsplit 4 }
  if (%me.split = off) { did -u nsplit 4 }
  if (%chan.split = on) { did -c nsplit 3 }
  if (%chan.split = off) { did -u nsplit 3 }
  mdxbegin
  mdx SetFont $dname 5,6 16 autohs
  mdx SetFont $dname 1,2,3,4 14  autohs
  mdx SetFont $dname 7,8 14  autohs

} 


on 1:dialog:nsplit:sclick:1: { set %split on |  echo -as 11[8Split Detecter11]8 Attivato }
on 1:dialog:nsplit:sclick:2: { set %split off |  echo -as 11[8Split Detecter11]8 Disattivato }
on 1:dialog:nsplit:sclick:4: {
  if ($did(4).state = 1) { set %me.split on | set %chan.split off | did -u nsplit 3 }
  else { set %me.split off | set %chan.split on | did -c nsplit 3  }
}
on 1:dialog:nsplit:sclick:3: {
  if ($did(3).state = 1) { set %chan.split on | set %me.split off | did -u nsplit 4 }
  else { set %chan.split off | set %me.split on | did -c nsplit 4  }
}
on 1:dialog:nsplit:sclick:5: 
on 1:dialog:nsplit:sclick:6: 



on *:QUIT: { if (. isin $1) && (. isin $2) && ($3 == $null) && (%split = on) { 
    if ($1 == %split.1) && ($2  == %split.2) goto end
    if (%chan.split = on) goto amsgsplit
    elseif (%me.split == on) goto echosplit  
    :amsgsplit
    amsg 13:::.Netsplit tra $1 e $2.:::  | splay sounds\netsplit.wav | goto next  
    :echosplit
    echo -as 15 $timestamp 15:::.Netsplit tra $1 e $2.:::  4 Angel Red Script | splay sounds\netsplit.wav | goto next
    :next
    set %split.1 $1
    set %split.2 $2

    :end
  }
}
