on *:text:*:#:{
if ($hget(HASHTABLENAME)) {
hfree -w HASHTABLENAME.TEMP
var %text = $strip($1-)
var %i = 1
while (%i <= $numtok(%text,32)) {
var %word = $gettok(%text,%i,32)
[color:blue];
while ($right(%word,1) == ?) { var %word = $left(%word,-1) }
; ^ remove an unlimited number of ? of the end of a word before testing it
; ^ This could be changed to deal with ? ! . , etc by changing to the following line
;while ($istok(? ! . $chr(44),$right(%word,1),32)) { var %word = $left(%word,-1) }
;[/color]
if ($len(%word) >= 4) && (!$pos(%word,?,1) && !$pos(%word,&,1) && !$pos(%word,*,1)) {
[color:blue];^ words with ?,&,* are ignored due to them being part of the wildmatching system of $hfind, also they arent legal characters in nicks
;[/color]
if ($hfind(HASHTABLENAME,$+(*,%word,*),0,w)) {
var %l = $v1
while (%l) {
var %item = $hfind(HASHTABLENAME,$+(*,%word,*),%l,w)
if (!$hget(HASHTABLENAME.TEMP,%item)) {
hadd -m HASHTABLENAME.TEMP %item $true
msg $chan %item is currently away reason $hget(HASHTABLENAME,%item)
}
dec %l
}
}
;
var %l = $findtok(%text,%word,0,32) | while (%l) { var %text = $reptok(%text,%word,.,%l,32) | dec %l }
; ^ speed up rotine by removing %word AND any repeats of it later in the text
}
inc %i
}
hfree -w HASHTABLENAME.TEMP
}
}