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.

Say a random text on 2 or more channels at once

Help for those learning Tcl or writing their own scripts.
Post Reply
R
Riddler
Halfop
Posts: 60
Joined: Sun May 20, 2007 10:20 pm
Location: Brasov, Romania
Contact:

Say a random text on 2 or more channels at once

Post by Riddler »

Hello guys, I've made a code that will randomly send a text to a channel, but only if that channel has set +speak flag

Here is the code :

Code: Select all

# say.tcl

### CONFIG ###

set speak(time) "2"

set speak(type) "PRIVMSG"

set speak(msgs) {
 "text1"
 "text2"
}

### CODE ###

setudef flag speak

if {![string match "*speaks*" [timers]]} {
  timer $speak(time) s:speaks
}

proc s:speaks { } {
 global speak
 if {![channel get $chan speak]} { return 0 }
  set rmsg [lindex $speak(msgs) [rand [llength $speak(msgs)]]]
    putserv "$speak(type) $chan :$rmsg"
  return 1
  timer $speak(time) s:speaks
  return 0
}

putlog "Loaded: say.tcl"
The problem is that the bot dosen't give me eny error and the messages ar not sent to the channels that I've set the +speak flag..

What's the problem ?!

Thanks
I am a man of few words, but many riddles
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

timer $speak(time) s:speaks

You don't tell your proc what channel to check.
Post Reply