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.

cycle code

Old posts that have not been replied to for several years.
Locked
User avatar
entrapmen
Voice
Posts: 27
Joined: Tue Jul 08, 2003 9:08 am
Location: TR

cycle code

Post by entrapmen »

I got a code like dat:

set timecycle 20

proc part_chan {} {
global timecycle
#Hangi kanallari cycle yapacak ? (which channels are goin to be cycle)
foreach chancycle #adam {
putserv "PART $chancycle :-=Spam%&!??=-"
timer $timecycle part_chan
}
foreach chancycle #ayva {
putserv "PART $chancycle :-=Spam%&!??=-"
timer $timecycle part_chan
}
}

how can i sort it? like givin all the channels in line? and how could the bot will stay out of chan for couple minutes(i wanna figure the waitin time). tx anyway...
<@ll the world is about smiles and cries>
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The way you use the foreach gives me creeps. Better use somethig like this:

Code: Select all

set timecycle 20
set chancycle "#adam #ayva"

proc part_chan { } { 
foreach chan [split $::chancycle] { 
  if {![botonchan $chan]} {
    continue
  }
  putserv "PART $chan :-=Spam%&!??=-" 
}
timer $::timecycle part_chan
}
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

well if u want it to stay out for few minutes use this code:

Code: Select all

set timecycle 20 
set timewait 2
set chancycle "#adam #ayva" 

proc part_chan { } { 
foreach chan [split $::chancycle] { 
  if {![botonchan $chan]} { 
    continue 
  } 
  channel set $chan +inactive 
  timer $::timewait "channel set $chan -inactive"
} 
timer $::timecycle part_chan 
}
the "timewait" is the time (in minutes) u want the bot to stay out of channel before rejoining.
User avatar
entrapmen
Voice
Posts: 27
Joined: Tue Jul 08, 2003 9:08 am
Location: TR

Post by entrapmen »

Sir_Fz wrote:well if u want it to stay out for few minutes use this code:

Code: Select all

set timecycle 20 
set timewait 2
set chancycle "#adam #ayva" 

proc part_chan { } { 
foreach chan [split $::chancycle] { 
  if {![botonchan $chan]} { 
    continue 
  } 
  channel set $chan +inactive 
  timer $::timewait "channel set $chan -inactive"
} 
timer $::timecycle part_chan 
}
the "timewait" is the time (in minutes) u want the bot to stay out of channel before rejoining.
Tnx for da code it works but there is a problem i couldnt get why it doesnt start the timer by it self. i had to write .tcl part_chan when bot restarts or dies. Is it about eggdrop version?
<@ll the world is about smiles and cries>
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

well, I don't have alot of experiance in this. but I think that the timer $::timecycle part_chan means that the bot will cycle every 20mins, which means when the bot joins the channel u have to wait 20mins to see if it will cycle.
any way try adding this code which will let the script work on connect:

Code: Select all

bind evnt - init-server do:part_chan

proc do:part_chan { init-server } {
part_chan }
plz note that I'm note sure of this code, but give it a try :)
User avatar
entrapmen
Voice
Posts: 27
Joined: Tue Jul 08, 2003 9:08 am
Location: TR

Post by entrapmen »

Sir_Fz wrote:well, I don't have alot of experiance in this. but I think that the timer $::timecycle part_chan means that the bot will cycle every 20mins, which means when the bot joins the channel u have to wait 20mins to see if it will cycle.
any way try adding this code which will let the script work on connect:

Code: Select all

bind evnt - init-server do:part_chan

proc do:part_chan { init-server } {
part_chan }
plz note that I'm note sure of this code, but give it a try :)
nope doesnt give any response...

when i do:
[16:33] <entrapmen> .tcl part_chan
[16:33] <Gandalf> Tcl: timer2837
it start the tcl :-?
<@ll the world is about smiles and cries>
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

try:

Code: Select all

set timecycle 20 
set timewait 2 
set chancycle "#adam #ayva"

###code###

bind join - $botnick!*@* start:timer

proc start:timer { nick uhost hand chan } {
if {([isbotnick $nick])} {
part_chan
 }
}

proc part_chan { } { 
foreach chan [split $::chancycle] { 
  if {![botonchan $chan]} { 
    continue 
  } 
  channel set $chan +inactive 
  timer $::timewait "channel set $chan -inactive" 
} 
timer $::timecycle part_chan 
}
in the bind join u can put your bot's nick instead of $botnick (i think it would be better)
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Misread

Post by spyda »

Sorry I wrote something else.. and it was not what he wanted so I deled it

:|

----------
ThePope
User avatar
entrapmen
Voice
Posts: 27
Joined: Tue Jul 08, 2003 9:08 am
Location: TR

Post by entrapmen »

Sir_Fz wrote:try:

Code: Select all

set timecycle 20 
set timewait 2 
set chancycle "#adam #ayva"

###code###

bind join - $botnick!*@* start:timer

proc start:timer { nick uhost hand chan } {
if {([isbotnick $nick])} {
part_chan
 }
}

proc part_chan { } { 
foreach chan [split $::chancycle] { 
  if {![botonchan $chan]} { 
    continue 
  } 
  channel set $chan +inactive 
  timer $::timewait "channel set $chan -inactive" 
} 
timer $::timecycle part_chan 
}
in the bind join u can put your bot's nick instead of $botnick (i think it would be better)
:cry: nope! noffin has changed.
i couldnt get why doesnt it work i ve tried some other ways but they didnt work too. :-?
<@ll the world is about smiles and cries>
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

did u try to put <your bot's nick>!*@* instead of $botnick!*@* in the join bind ?

also man, are u waiting 20mins for the bot to cycle before judging if its working ?
User avatar
entrapmen
Voice
Posts: 27
Joined: Tue Jul 08, 2003 9:08 am
Location: TR

Post by entrapmen »

Sir_Fz wrote:did u try to put <your bot's nick>!*@* instead of $botnick!*@* in the join bind ?
Yea i did it Gandalf!*@* i check spell checkin there is no fault.
also man, are u waiting 20mins for the bot to cycle before judging if its working ?
:P i change the timecycle to 1 min. so i dun have to wait much. :-? :-?
<@ll the world is about smiles and cries>
n
nso
Voice
Posts: 19
Joined: Fri Apr 25, 2003 4:45 pm

Post by nso »

i found this to be a good approach

Code: Select all

# channel to cycle
set cyclechan "#blabla"

# minutes between each cycle
set timecycle 120 

# minutes to idle before rejoining chan
set timewait 1

bind RAW * 366 cyclestart

proc cyclestart { from key arg } {
global cyclechan timecycle
        set chan [lindex [split $arg] 1]
        if { $chan != $cyclechan } { return 0 }
        timer $timecycle cycle
}

proc cycle { } {
global scanchan timewait
        channel set $cyclechan +inactive
        timer $timewait "channel set $cyclechan -inactive"
}

you could alternatively use for-statements if you need more chans, I didn't bother adding that feature
Locked