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.

My channel CYCLE tcl for the bot does not seem to work!

Old posts that have not been replied to for several years.
Locked
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

My channel CYCLE tcl for the bot does not seem to work!

Post by awyeah »

Hello I developed a small, continously channel cycler script
for my spam detector eggdrop bot, but I get an error.

[20:50] Tcl error [cycle]: called "cycle" with too many arguments

#Set channel to activate private spam detector on
set spamchan "#chatzone"

#Set the time when the bot will leave the channel, after staying on the channel (in mins)
set leavetime 4

#Set the time when the bot will rejoin the channel in its cycle, after parting the channel (in secs)
set rejointime 90

bind pub m .cycle cycle
timer $rejointime cycle

proc cycle {} {
global spamchan leavetime rejointime
channel set $spamchan +inactive
putlog "Cycling $spamchan to detect spammers, well rejoin $spamchan after $rejointime secs now."
utimer $rejointime { channel set $spamchan -inactive }
putlog "Rejoined $spamchan after a cycle of $rejointime secs."
timer $leavetime cycle
}
It gives me an error, saying too many arguments.
I don't understand what is wrong could you please help me out.

I can put
putserv "PART $spamchan"
putserv "JOIN $spamchan"

That makes it work, but the bot rejoins the second after it has parted, making it a quick cycle, one lasting 1 second or less.

Through the INACTIVE command I wanted to make a longer delay in cycle when it is parted. So spam bots don't ignore it for fast cycles, join/parts.

Please help me.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

This is wrong at the beginning.

timer $rejointime cycle

Instead use this. Its much better.

Code: Select all

bind evnt - init-server Start

proc Start {type} {
global rejointime
utimer $rejointime cycle
return 1 }
That should fix it!!!

Plus you want seconds not Minutes! Use utimer command instead of timer.
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well, thats almost the same
it just activates when you are
connecting to the server, not when
then tcl scripts are being loaded.

I wanted a delay in the channel cycle
thats all.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

awyeah: Read doc/tcl-commands.doc , and pay attention to the bindings section. (ie. Look at what parameters a pub bound procedure requires in it's declaration).
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Thanks!

Anyway, I got it working eventually.. for those of you
people who want the code here it is:

[quote]
#Set channel to activate private spam detector on
set spamchan "#funchat"

#How many minutes should the bot idle in channel before it parts for the cycle (in mins)
set spamdet_idletime "4"

#How many seconds should the bot stay gone in the cycle before rejoining the channel (in secs)
set spamdet_gonetime "60"


if {![string match *spamdetect* [timers]]} {timer $spamdet_idletime spamdetect}

proc spamdetect {} {
global botnick spamchan spamdet_idletime spamdet_gonetime
channel set $spamchan +inactive
putlog "CYCLE: Cycling $spamchan to detect spammers."
putlog "CYCLE: Will rejoin $spamchan after $spamdet_gonetime secs."
utimer $spamdet_gonetime "channel set $spamchan -inactive"
if {![string match *spamdetect* [timers]]} {timer $spamdet_idletime spamdetect}
}


This works, like a charm... however there is a problem
If you make the bot quit, while it's still in the cycle, meaning
the channel is inactive then, even when you restart it, it wont
join that channel ($spamchan) as it is +inactive.

I have to clear that and add a bind a procedure on event
as commy posted, to set it -inactive.

That should do it!
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

if {![string match *spamdetect* [timers]]} {timer $spamdet_idletime spamdetect}

Your forgetting the timer!!!

Its utimer u want! :mrgreen:
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Timer is a valid eggdrop Tcl command, Commy... If he wants to use it, that is his perogative.
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

#How many seconds should the bot stay gone in the cycle before rejoining the channel (in secs)

This indicates that he wants utimer and not timer!!!! :P

Just pointing that out. :mrgreen:
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

CoMMy wrote:#How many seconds should the bot stay gone in the cycle before rejoining the channel (in secs)

This indicates that he wants utimer and not timer!!!! :P

Just pointing that out. :mrgreen:
That is for his "gonetime" variable... Which he uses a utimer...
For the "idletime" variable, he uses timer...

You need to read more carefully.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Thats why I didn't reply back.

I guess, when you start fiddling with scripts
and get their know how, then by messing around
checking what kind of errors you get in the DCC
with the bot, you can fix them.

Some may take time, and some maybe an error
of syntax, very easy to fix.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well heres the full code.
It is working great actually I made it for a private query message
spam detector eggdrop bot, which cycles the channel continuously
detecting spammers and inviters.

The timers don't mess up even and its working perfect.
Here is the full correct code if someone wants it, feel
free to use it:
#Set the channel on which you want the bot to cycle on
set spamchan "#chatzone"

#How many minutes should the bot idle in channel before it parts for the cycle (in mins)
set spamdet_idletime "4"

#How many seconds should the bot stay gone in the cycle before rejoining the channel (in secs)
set spamdet_gonetime "60"


bind evnt - connect-server resetinactive
bind evnt - prerehash resetinactive
bind evnt - prerestart resetinactive

if {![string match *spamdetect* [timers]]} {timer $spamdet_idletime spamdetect}

proc resetinactive {type} {
global spamchan
channel set $spamchan -inactive
putlog "INACTIVE: Set channel settings for $spamchan back to -inactive."
return 1
}

proc spamdetect {} {
global botnick spamchan spamdet_idletime spamdet_gonetime
channel set $spamchan +inactive
putlog "CYCLE: Cycling $spamchan to detect spammers."
putlog "CYCLE: Will rejoin $spamchan after $spamdet_gonetime secs."
utimer $spamdet_gonetime "channel set $spamchan -inactive"
if {![string match *spamdetect* [timers]]} {timer $spamdet_idletime spamdetect}
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked