| View previous topic :: View next topic |
| Author |
Message |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Sep 30, 2006 12:11 pm Post subject: Change to use "*" for all chans? |
|
|
Can someone help me make this work on all chans using "*" instead of #chan1 #chan2
[12:06] Tcl error in script for 'timer1':
[12:06] illegal channel: *
| Code: |
################################################################################################################
## set the channel to display automatic WoW lines, include the '#' prefix
set wowchans "*"
## set the timer interval (in minutes) between WoW lines
set wowtime "60"
if { [info exists wowtime] } { timer $wowtime "timer:wow" }
set wowtxt "wow.txt"
set wowver "v2.01"
bind pub - !wow disp:wow
proc disp:wow {nick host handle chan text} {
# Need to leave 'wowchan' in the global dec so it'll carry over to the timer
global wowchans wowchan wowtxt
# test if the channel is in the wowchans list and set 'wowchan' accordingly.
if {[lsearch -exact $wowchans $chan] != -1} {
set wowchan $chan
} else {
# did not match a channel in the "wowchans list"
return
}
if { [isop $nick $wowchan] || [ishalfop $nick $wowchan] || [isvoice $nick $wowchan] } {
if { [lindex $text 0] != "" } {
set wowto [lindex $text 0]
} else {
set wowto $wowchan
}
set wowfile [open $wowtxt r]
set wowread [split [read $wowfile] \n]
close $wowfile
putserv "PRIVMSG $wowto :[lindex $wowread [rand [llength $wowread]]] "
} else {
set wowfile [open $wowtxt r]
set wowread [split [read $wowfile] \n]
close $wowfile
putserv "PRIVMSG $nick :[lindex $wowread [rand [llength $wowread]]] "
}
}
proc timer:wow {} {
global botnick wowchans wowchan wowtime wowtxt
set wowfile [open $wowtxt r]
set wowread [split [read $wowfile] \n]
close $wowfile
foreach wowchan $wowchans {
if { [onchan $botnick $wowchan] } {
putserv "PRIVMSG $wowchan :[lindex $wowread [rand [llength $wowread]]] "
}
}
timer $wowtime "timer:wow"
}
putlog "Words of Wisdom $wowver TCL (timer: $wowtime mins) - Loaded! "
#
|
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Sep 30, 2006 12:22 pm Post subject: |
|
|
You'll have to use the command channels instead of "*" to get the list of current channels (can't expect a wildcard to expand to a list of channels, now can you...). _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Sep 30, 2006 12:37 pm Post subject: |
|
|
It does work when set to "#chan1 #chan2" but I rather it work on all channels bot is in...
I tried this script below from TCL Archives but it only sent msg to 1 channel and not the other 5.
| Code: |
##########################################################################################
## Discription ##
## ##
## nicepal.adv.tcl Version 1.0 Date: 07 October 2002 Monday ! ##
## Advertizing Your messeges in channel rendom types .. ##
## Created by NicePaL and Very Thanks for Pulse (#Eggdrop) Who Help me for Bugs. ##
## I Hope you will like my this 2nd TCL as you have been used nicepal.tcl ##
## Downlaod cute TCL's from www.EggHelp.org/tcl.htm aLso Thanks for slennox ##
## For Help Join #Eggdrop or #DALnetBoT Thanks for using my TCL ##
## ##
##########################################################################################
## Set your channel for Advertize your text messeges ..
## If you want to Advertize in all channel where is your bot parking then use "*"
## other "#channel"
set speaks_chans "*"
# Set you want in XXX minute you bot always talk on minute
set speaks_time "10"
## ----------------------------------------------------------------
## --- Don't change anything below here if you don't know how ! ---
## ----------------------------------------------------------------
### Advertizing Messeges are Here ###
# Set the next lines as the random speaks msgs you want to say
set speaks_msg {
"Write Down you Advertizing messeges here"
"www.Egghelp.org/tcl.htm is cute Web site for TCL's"
"WeLcome to #Eggdrop and #DALnetBoT channel, Where you can Get OnLine Help"
}
if {![string match "*time_speaks*" [timers]]} {
timer $speaks_time time_speaks
}
proc time_speaks {} {
global speaks_msg speaks_chans speaks_time
if {$speaks_chans == "*"} {
set speaks_temp [channels]
} else {
set speaks_temp $speaks_chans
}
foreach chan $speaks_temp {
set speaks_rmsg [lindex $speaks_msg [rand [llength $speaks_msg]]]
puthelp "PRIVMSG $chan :$speaks_rmsg"
timer $speaks_time time_speaks
return 1
}
}
putlog "Advertizing in Channel loaded Successfuly..."
putlog "Ver 1.0 By NicePaL & Special Thanks for Pulse #DALnetBoT & #EggDrop"
|
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Sep 30, 2006 12:40 pm Post subject: |
|
|
That last script has the return-command inside the foreach loop, which is why it only sends to one channel... simply removing it should solve the problem _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Sep 30, 2006 12:43 pm Post subject: |
|
|
| so your saying to remove 'return 1'? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Sep 30, 2006 12:47 pm Post subject: |
|
|
yes... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Sep 30, 2006 12:52 pm Post subject: |
|
|
| Thanks, worked. |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Sep 30, 2006 12:56 pm Post subject: |
|
|
| Hmm it flooded every channel non stop lol |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Sep 30, 2006 2:06 pm Post subject: |
|
|
Ahh... the timer-command is also inside the foreach-loop..
you'll have to put that outside it..
(basically move it down so it's below one of the } _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
cache Master
Joined: 10 Jan 2006 Posts: 306 Location: Mass
|
Posted: Sat Sep 30, 2006 2:35 pm Post subject: |
|
|
Thanks  |
|
| Back to top |
|
 |
|