I got the idea for this after commenting on the snippet: http://www.hawkee.com/snippet/3011/ by Ovaldo.
The dialog allows you to add/remove words to/from a hash table. Whenever someone in a channel you are in says a word that's in the hash table, you will get an echo informing of who said what word in what channel, as well as a beep. (You can turn these off in the settings tab.)
To open the dialog, right click on the channel or open the menubar menu, and click 'Word Alert'. Type in the edit box and click 'Add' to add words, to remove a word, select it in the list box and click 'Remove'. When you are done, simply click 'Done'. Click the settings tab to turn echoing and beeping on and off.
dialog wordalert {
title "Word Alert"
size -1 -1 90 137
option dbu
tab "Words", 7, 0 0 95 250
tab "Settings", 8
;tab 'Words'
text "Enter a Word" 1, 3 18 32 6, tab 7
edit "" 2, 3 26 60 10, autohs tab 7
button "Add" 3, 65 25 20 12, flat disable tab 7
button "Done" 4, 21 122 20 12, tab 7
list 5, 3 40 81 83, vsbar tab 7
button "Remove" 6, 44 122 24 12, disable tab 7
;tab 'Settings'
box "Echoing" 9, 13 15 30 30, tab 8
radio "On" 10, 19 25 20 6, tab 8 group
radio "Off" 11, 19 35 20 6, tab 8
box "Beeping" 12, 46 15 30 30, tab 8
radio "On" 13, 52 25 20 6, tab 8 group
radio "Off" 14, 52 35 20 6, tab 8
button "Done" 15, 34 48 20 12, ok tab 8
}
on *:dialog:wordalert:*:*: {
if (( $devent == sclick )) {
if (( $did == 3 )) {
if (( $hfind(wordalert,$did(2),1) == $null )) {
did -a wordalert 5 $iif($did(5) != $null,$crlf) $+ $did(2)
hadd wordalert $did(2)
}
did -fr wordalert 2
did -b wordalert 3
}
if (( $did == 4 )) { dialog -k wordalert }
if (( $did == 10 )) { unset %wordalert.echo.off }
if (( $did == 11 )) { set %wordalert.echo.off on }
if (( $did == 13 )) { unset %wordalert.beep.off }
if (( $did == 14 )) { set %wordalert.beep.off on }
if (( $did == 5 )) {
if (( $did(wordalert,5,1).sel != 0 )) { did -e wordalert 6 }
}
if (( $did == 6 )) {
if (( $did(wordalert,5,1).sel != 0 )) {
hdel wordalert $did(wordalert,5,1).seltext
did -d wordalert 5 $did(wordalert,5,1).sel
did -b wordalert 6
}
}
if (( $did == 8 )) {
dialog -bs wordalert -1 -1 90 65
}
if (( $did == 7 )) {
dialog -bs wordalert -1 -1 90 137
}
}
if (( $devent == edit )) {
if (( $did == 2 )) {
did $iif($did(2) == $null,-b,-e) wordalert 3
}
}
if (( $devent == init )) {
if (( !$hget(wordalert) )) { hmake wordalert 1000 }
did -ft wordalert 2
var %a = 1
while (( %a <= $hget(wordalert,0).item )) {
did -a wordalert 5 $iif(%a != 1,$crlf) $+ $hget(wordalert,%a).item
inc %a
}
did -c wordalert $iif(!%wordalert.echo.off,10,11)
did -c wordalert $iif(!%wordalert.beep.off,13,14)
}
}
on *:TEXT:*:#:{
var %a = 1
while (( %a <= $numtok($1-,32) )) {
if (( $hfind(wordalert,$gettok($1-,%a,32),1) )) {
if (( !%wordalert.echo.off )) echo -a $+ $nick $+ said $+ $gettok($1-,%a,32)) $+ on $+ $chan $+
if (( !%wordalert.beep.off )) set %wordalert.beep on
}
inc %a
}
if (( %wordalert.beep )) { beep | unset %wordalert.beep }
}
menu channel,menubar {
Word Alert:dialog $iif($dialog(wordalert),-v,-m) wordalert wordalert
}
Check this thread: http://www.hawkee.com/phpBB2/viewtopic.php?t=12813 . The script requested is similar to what you wrote here, the difference is you\'re is for the client only. It\'s all written in hash tables so it would be faster than trying to access the text file every time. Hope it would help you out. :)