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.

Change to use "*" for all chans?

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Change to use "*" for all chans?

Post by cache »

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: Select all

################################################################################################################ 
## 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! " 
# 
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

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: Select all

##########################################################################################
##                                   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"
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

so your saying to remove 'return 1'?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

yes...
NML_375
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Thanks, worked.
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Hmm it flooded every channel non stop lol
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Thanks 8)
Post Reply