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.

Looking for a script to save the poor trouts!

Old posts that have not been replied to for several years.
Locked
t
thedude0001
Voice
Posts: 7
Joined: Sat Dec 18, 2004 8:32 pm

Looking for a script to save the poor trouts!

Post by thedude0001 »

Hi everybody!

I saw a really nice script in an IRC channel today. It just reacts to the widely known"abc slaps xyz around a bit with a large trout" by saying "/me takes the trout out of abcs hand and puts it back in the sea. Trouts saved: x".

I instantly fell in love with this script and decided that this would be a great addition to my eggdrop as it is already running the fishdrop script. The user who had this script told me that he only had it for mIRC. So I started to search the web, but all I found was the mIRC script. And to complete my misery I have to admit that I don't really know how to write a TCL script for an eggdrop.

So my question would be: Is there any coder out here who thinks this is a great idea and could write this script for me? I would really appreciate it. :mrgreen:

The counter should be global (for all chans the bot is on) and should be saved to a file on a regular basis so that the counter doesn't get resetted when the bot restarts.

Thanks a lot!
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

set troutfile [pwd]/trouts.save

bind ctcp - ACTION save:the:trouts
proc save:the:trouts {nick host hand dest key arg} {
	if {![info exists ::trouts]} { set ::trouts 0 }
	if {[string match -nocase "*slaps * around a bit with a large trout" $arg]} {
		putserv "PRIVMSG $dest :\001ACTION takes the trout out of ${nick}s hand and puts it back in the sea. Trouts saved: [incr ::trouts]"
	}
}

bind evnt - logfile save:trouts:file
bind evnt - prerestart save:trouts:file
proc save:trouts:file {args} {
	puts [set fid [open $::troutfile w]] $::trouts
	close $fid
}

bind evnt - connect-server load:trouts:file
proc load:trouts:file {args} {
	set ::trouts [read [set fid [open $::troutfile r]]]
	close $fid
}
just had to ;)
Elen sila lúmenn' omentielvo
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

well, I've already written this when forum went down, so here it is:

Code: Select all

set s "takes the trout out of %s's hand and puts it back in the sea. Trouts saved: %d"
if ![catch {set f [open trouts]}] {
  set trouts [gets $f]; close $f
} {set trouts 0}
bind time - "%0 % % % %" save
proc save {m h d mo y} {
  set f [open trouts w]; puts $f $::trouts; close $f
}
bind ctcp - ACTION slap
proc slap {n u h d k t} {
  if [string equal -nocase $d $::botnick] return
  if [string match -nocase *slaps* $t] {
    puthelp "privmsg $d :\001ACTION[format $::s $n [incr ::trouts]]\001"
  } 
}
Locked