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.

How to make timer in seconds and not minutes?

Help for those learning Tcl or writing their own scripts.
Post Reply
d
daigo
Voice
Posts: 37
Joined: Fri Jun 27, 2014 8:02 pm

How to make timer in seconds and not minutes?

Post by daigo »

Here is my script:

Code: Select all

set ai_chan "#daigo"

set ai_time 1

set ai_msgs {
  "please watch your step"
  "i like cookies"
}

proc ai_start {} {
  global ai_time
  if {[string match *ai_sendmsg* [timers]]} {return 0}
  timer [expr [rand $ai_time] + 1] ai_sendmsg
}

proc ai_sendmsg {} {
  global botnick ai_chan ai_msgs ai_time
  if {[validchan $ai_chan]} {
    puthelp "PRIVMSG $ai_chan :[lindex $ai_msgs [rand [llength $ai_msgs]]]"
  }
  timer [expr [rand $ai_time] + 1] ai_sendmsg
}

set ai_chan [string tolower $ai_chan]

ai_start
It says one of those 2 random messages I have in my script, at random intervals, with the minimum time lapse of 1 minute. How do I make the timer in seconds instead of minutes so that I can make the script say something at least every 30 seconds instead of at least every 1 minute?
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Re: How to make timer in seconds and not minutes?

Post by willyw »

daigo wrote:
....
How do I make the timer in seconds instead of minutes ...

Go here:
http://www.eggheads.org/support/egghtml ... mands.html
and text search for
utimer



-
Post Reply