Hey, I`m looking for a scrirpt that when someone shouts in caps it will reply in all caps with another message that was shouted in all caps by someone else.
# flag
setudef flag loud
# bind
bind pubm - * my:reply:catcher
# create catch for LOUD chatter
proc my:reply:catcher {nick uhost hand chan text} {
# loud is activated on the channel?
if {[channel get $chan loud]} {
# does this string even have alphabet characters
if {[regexp -nocase {[::alpha::]} $text]} {
# yes, is this person using ALL CAPS?
if {[string equal [string toupper $text] $text]} {
# yes, before replying is there even a reply or is
# our list corrupt?
if {[string length [set reply [my:reply:proc $text]]]} {
# LOUD reply isn't empty so let's spam it :)
putserv "privmsg $chan :[string toupper $nick], $reply"
}
}
}
}
# this is a pubm bind, we must return 0 here because the last
# value returned otherwise will be 1 from the putserv. We do
# NOT want a 1 returned from a pubm bind. This causes it to
# do the reverse of what you think. pubm binds differ from
# pub binds in this way.
return 0
}
# reply proc helper for the catcher
proc my:reply:proc {text} {
# do we already have a LOUD list built?
if {[info exists ::__my_list]} {
# yes, then reply randomly from the present list
# before we add this text to our list
set reply [lindex $::__my_list [rand [llength $::__my_list]]]
} else {
# no, then reply that they are LOOOUUDDD!
set reply "LOOOOUUUDDDDDD!!!!"
}
# add the text to our LOUD list
lappend ::__my_list $text
# return the LOUD reply
return $reply
}
#eof
fixed.
added alpha check before replying LOUDLY.
Last edited by speechles on Thu Feb 18, 2010 5:50 pm, edited 1 time in total.
[16:20:16] <@Allyn> Cash-strapped Portsmouth are understood to have asked the Premier League for permission to sell players outside the transfer window.
[16:20:19] <@Allyn> ............
[16:20:21] <@EPL> ALLYN,
[15:35:09] <ahmadinejad> well good for you that you managed to google it, Oreo, despite the fact that you are.. you.
[15:35:11] <ahmadinejad>
[15:35:12] <@EPL> AHMADINEJAD, OMG
Uhm seems like sometimes it replies even though the person didn't write the text with caps..
Football wrote:Uhm seems like sometimes it replies even though the person didn't write the text with caps..
It didn't contain an alphabet check, now it does. Use the code I've altered found above. [::alpha::] should behave differently than [a-z] (foreign languages) in regard to full alphabetic ranges.