Word Alert

Platform:  mIRC
Published  Aug 07, 2007
Updated  Aug 09, 2007
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
}

Comments

Sign in to comment.
Wolfsong   -  Sep 07, 2012
Awesome! It took me a moment to realize that I had to place the code under the "Remote" tab (I'm new at coding, but this was something that I'd been really wanting for a while), but once I figured it out it works like a charm. Very useful! Thanks!
 Respond  
blake   -  Jul 19, 2008
The list wipes itself every time I disconnect so I have to readd the words

Also would it be possible to add an extra box were we could put the meaning of the word reasom bein I moderate an asian chat room on the server it would save having to look at notes all the time.

Many Thanks
 Respond  
Callison1   -  Aug 09, 2007
Thanks for the help and advice guys, I\'ve re-written it to use a hash table(I have never used hash tables before, so if you see anything wrong with it please tell me). I put in a beep function instead of just echo, but both of these can be turned off in the new settings tab.
 Respond  
Ovaldo   -  Aug 08, 2007
Glad I can help
 Respond  
napa182   -  Aug 07, 2007
nice works well
 Respond  
xDaeMoN   -  Aug 07, 2007
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. :)
 Respond  
FRISH   -  Aug 07, 2007
nice i like it, maybe add \"beep 3\" or w/e when the word is said? And maybe an option in the menu to turn echo and beep if ya do it on and off just incase it gets annoying ;)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.