if ($hget(%active.chan,$1)) {
var %hreplace = $hget(%active.chan,$1)
if (hnick isin %hreplace) && (hchan isin %hreplace) {
msg $chan $replace(%hreplace,hnick,$2,hchan,$chan,hname,$nick)
}
elseif (hnick isin %hreplace) {
msg $chan $replace(%hreplace,hnick,$2)
}
elseif (hchan isin %hreplace) {
msg $chan $replace(%hreplace,hchan,$chan)
}
elseif (hname isin %hreplace) {
msg $chan $replace(%hreplace,hname,$nick)
}
else { msg $chan %hreplace }
}