egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Random Topic at Given time

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Romeyo
Voice


Joined: 01 Nov 2005
Posts: 12

PostPosted: Sun Dec 11, 2005 3:20 pm    Post subject: Random Topic at Given time Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 11, 2005 6:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber