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.

Help me with this code :)

Old posts that have not been replied to for several years.
Locked
User avatar
jsilvestre
Voice
Posts: 20
Joined: Sat Mar 05, 2005 6:02 am
Location: Lisbon, Portugal

Help me with this code :)

Post by jsilvestre »

set jp(time) 5
bind time - "* * * * *" jp
proc jp {1 2 3 4 5} {global jp;set ctime [clock seconds]
if {![info exists jp(ctime)]} {set jp(ctime) $ctime} else {
if {[expr ($ctime - $jp(time)) / 60]>="$jp(time)"} {
set jp(ctime) $ctime
foreach c [channels] {putserv "part $c :A verificar existência de publicidade/spam";putserv "join $c"}
}
}
}
What´s wrong with this code? The eggdrop dont say message when he part channel and part channel every 1 minute :|

I wait for sugestions :) :lol:
Best Regards

José Eduardo Silvestre
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

maybe the irc doesn't support it

could you maybe make it more clear what this bot is supposed to do.. cause it seems a bit weird to me..
XplaiN but think of me as stupid
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

If your on Quakenet or undernet, there is a big chance the channel might have +u which hides part messages.

Also, there is no need to make it join again, and eggdrop should automaticly rejoin a channel unless a channel is removed by channel remove.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Re: Help me with this code :)

Post by De Kus »

jsilvestre wrote:bind time - "* * * * *" jp
tried to change to this?

Code: Select all

bind time - "?0*" jp
bind time - "?5*" jp
you can remove the whole clock/ctime code then. if you want to do it with 1 bind, then check for [regexp {(0|5).} $1] (no garantie for the regualr expression ^^) or check if [expr fmod($1, 5)] or [expr fmod($1, 10)] is zero within the proc. all 3 soltions are 1000% better than saving the time and triing to figure out if 5min has passed :D.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Something like this is more easier:

Code: Select all

timer 5 channel:cycle

proc channel:cycle {} {
  foreach c [channels] {
  putserv "part $c :A verificar existência de publicidade/spam"
  channel remove $c
  timer 1 "channel add $c"
  }
 timer 5 channel:cycle
}
Here I've set the cycle delay, stay in the channel every 5 minutes and cycle it after every 5 minutes for 1 minute only and rejoin. This is basic.

I basically use +inactive and -inactive, which is better than adding and deleting the channel again and again, but you want to specify a message on part so, I guess this can do it as well.

Code: Select all

putserv "part $c :A verificar existência de publicidade/spam"
putserv "join $c"
This code will produce very rapid cycles as MeTroiD explained. You can force an eggdrop to part a channel manually, but when that channel is added to the dynamic channel list, then it executes a timer checking if the bot is on the channel or not? if not, go ahead and join it. (possible reasons could be its banned from the channel, unable to join and so...)
·­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 »

I am aware that all channel records will be deleted, as it harsh to add and remove channels so frequently. But you can specify parameters and options after "channel add" in the code and it will go ahead and set it to them. But adding them everytime would seem useless and disturbing.

Actually I mentioned +inactive if you read all of my post, (I use it). Inactive makes the bot part the channel, hence being inactive on it. You can first part the bot with putserv and +inactive the channel immediately. Then whenever you feel like -inactive on the channel and woolah, it joins back in immediately.

Code: Select all

timer 5 channel:cycle

proc channel:cycle {} {
  foreach c [channels] {
  putserv "part $c :A verificar existência de publicidade/spam"
  channel set $c +inactive
  timer 1 "channel set $c -inactive"
  }
 timer 5 channel:cycle
} 
You could also go ahead and check for if timer exists, to make it better... like I have. And one thing more. Bind on rehash, and on-connect in evnt and make it set all channels -inactive via foreach [channels]. Because sometime when the bot is in the middle of a cycle and you restart, rehash channels set to -inactive will remain as they are for a double cycle. And putserv part would be parting the bot from a non-existant channel then.
·­awyeah·

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