| View previous topic :: View next topic |
| Author |
Message |
Romeyo Voice
Joined: 01 Nov 2005 Posts: 12
|
Posted: Sun Dec 11, 2005 3:20 pm Post subject: Random Topic at Given time |
|
|
Hi,
I have written a tcl for setting random topic from a given time ... But its not changing the topic at all... My code is,
| Code: |
#set the time to change topic in minutes (ex: for 8 hours = 8hours x 60mins = 480 mins)
set topic-at- 5
#set the channels to set the topic on delimited with commas (ex: #chan1,chan2)
set chan #channel-1,#channel-2
#set the topics u wanna use within double quots
set adtext {
"Best file compression around: 'DEL *.*' = 100% compression"
"If debugging is the process of removing bugs, then programming must be the process of putting them in."
"Doctor : A Person Who Kills Your Ills By Pills, And Kills You With His Bills."
}
set notnick "$botnick"
set notnick [string tolower ${nick}]
if {![info exists {ald}]} {
global notnick chan topic-at- adtext
set ald 1
timer ${topic-at-} printing
}
proc printing {} {
global notnick chan topic-at- adtext
set printochan [lindex $adtext [rand [llength $adtext]]]
putquick "TOPIC $chan :$printochan"
timer ${topic-at-} printing
}
|
Thanks... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Dec 11, 2005 6:43 pm Post subject: |
|
|
Your code has a lot of bogus stuff, try this:
| Code: | #set the time to change topic in minutes (ex: for 8 hours = 8hours x 60mins = 480 mins)
set topictime 5
#set the channels to set the topic on delimited with commas (ex: #chan1,chan2)
set topicchans "#channel-1 #channel-2"
#set the topics u wanna use within double quots
set topictext {
"Best file compression around: 'DEL *.*' = 100% compression"
"If debugging is the process of removing bugs, then programming must be the process of putting them in."
"Doctor : A Person Who Kills Your Ills By Pills, And Kills You With His Bills."
}
if {[timerexists settopic] == ""} {
timer $topictime settopic
}
proc settopic {} {
global topictime topicchans topictext
set topic [lindex $topictext [rand [llength $topictext]]]
foreach chan $topicchans {
if {[botonchan $chan] && [botisop $chan]} {
putquick "TOPIC $chan :$topic"
}
}
timer $topictime settopic
} |
PS: alltools.tcl should be loaded for the [timerexists] command to work. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|