rendered paste bodydialog nickcomp {
title "Nick completer"
size -1 -1 244 134
option pixels
icon script\pics\nntray.ico
list 3, 12 18 130 104, sort size vsbar
button "C&omplete", 1, 156 8 84 24, default
button "&Don't complete", 4, 156 32 84 24
button "&Cancel", 2, 156 106 84 24, cancel
box "Choose nick to complete", 5, 4 2 146 128
}
on *:dialog:nickcomp:*:*:{
if ($devent == sclick) {
if ($did == 1) {
if ($did(3).seltext) {
var %x = $replace(%nickcomp.format,<nick>,$+(,$left($tcase($n.comp($left($1,-1),1)).space,1),,$right($tcase($n.comp($left($1,-1),1)),-1)))
msg %nickcomp.chan $iif($cchan(%nickcomp.chan),$strip(%x),%x) $wd(%nickcomp.text,2-)
dialog -c nickcomp
}
}
elseif ($did == 4) {
msg %nickcomp.chan %nickcomp.text
dialog -c nickcomp
}
}
elseif ($devent == dclick) && ($did == 3) && ($did(3).seltext) {
var %x = $replace(%nickcomp.format,<nick>,$+(,$left($tcase($n.comp($left($1,-1),1)).space,1),,$right($tcase($n.comp($left($1,-1),1)),-1)))
msg %nickcomp.chan $iif($cchan(%nickcomp.chan),$strip(%x),%x) $wd(%nickcomp.text,2-)
dialog -c $dname
}
elseif ($devent == close) { unset %nickcomp.text %nickcomp.chan }
}