This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Loud Bot

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Loud Bot

Post by Football »

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.
Idling at #Football, Quakenet.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

# 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.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

.chanset #Xabriel +loud
Successfully set modes { +loud } on #Xabriel.


[13:01:05] <McShizzle> OMG
[13:01:06] <McShizzle> LOL

The bot doesn't reply
Idling at #Football, Quakenet.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Remove the "!" from this line

Code: Select all

if {![channel get $chan loud]} {
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

Thank worked, cheers!
Idling at #Football, Quakenet.
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Post by Football »

[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, :D

[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> :D
[15:35:12] <@EPL> AHMADINEJAD, OMG

Uhm seems like sometimes it replies even though the person didn't write the text with caps..
Idling at #Football, Quakenet.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

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.
r
radix
Voice
Posts: 3
Joined: Tue Jan 10, 2012 9:59 pm

Post by radix »

any chance flat file storage could be added to this? thanks.
Post Reply