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.

delay output

Help for those learning Tcl or writing their own scripts.
Post Reply
w
whittinghamj
Op
Posts: 103
Joined: Sun May 21, 2006 4:50 pm

delay output

Post by whittinghamj »

Hi yall

I am trying to delay the time between putserv lines, eg

line 1
(wait ten seconds)
line 2
(wait another ten sections)
line 3

see what I mean?

Is there a way to do this - cheers
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Re: delay output

Post by TCL_no_TK »

There is a few. puthelp which will only send 1 line at a time, you could also looking into using timer or even time if you wanted to do it in minuets. timer uses seconds, so you could do after each line [expr lineNumber +1]

Code: Select all

timer [expr lineNumber +1] putserv "privmsg $channel :hello world!"
check the docs @ http://eggheads.org/support/egghtml/1.6 ... mands.html.
w
whittinghamj
Op
Posts: 103
Joined: Sun May 21, 2006 4:50 pm

Post by whittinghamj »

thanks for the info here is what i am actually using the real proc i mean - cos i am not sure how to use your suggested code. I was looking for timer as I need the time delay to be say 10 - 15 seconds

Code: Select all

proc pub:send_nfo {nick host hand chan text} {
putlog 1
  global mysql
  set output [mysqlsel $mysql "SELECT * FROM nfo_cache WHERE status  = '0'" -list]
putlog 2
  foreach row $output {
putlog 3
    set site [lindex $row 1]
putlog 4
    set section [lindex $row 2]
putlog 5
    set rls [lindex $row 3]
putlog 6
    putquick "PRIVMSG #pre.nfo-feed :!fetch_nfo $site $section $rls"
putlog 7
    mysqlexec $mysql "UPDATE nfo_cache SET status = '1'"
  }
}
please ignore the putlog lines for debugging :D
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You can create your own delayed queues here with this script. Download it from:
http://barkerjr.net/pub/irc/eggdrop/Scr ... cl.tar.bz2
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Re: delay output

Post by YooHoo »

TCL_no_TK wrote:There is a few. puthelp which will only send 1 line at a time, you could also looking into using timer or even time if you wanted to do it in minuets. timer uses seconds, so you could do after each line [expr lineNumber +1]

Code: Select all

timer [expr lineNumber +1] putserv "privmsg $channel :hello world!"
check the docs @ http://eggheads.org/support/egghtml/1.6 ... mands.html.
utimer uses seconds, timer uses minutes.
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

sorry, type'o :roll: *utimer.
Try this:

Code: Select all

proc pub:send_nfo {nick host hand chan text} {
global mysql
 set output [mysqlsel $mysql "SELECT * FROM nfo_cache WHERE status  = '0'" -list]
  set c 10
   foreach row $output {
    set c [expr $c +5]
     utimer $c putserv "PRIVMSG #pre.nfo-feed :!fetch_nfo [lindex $row 0] [lindex $row 1] [lindex $row 2]"
   }; mysqlexec $mysql "UPDATE nfo_cache SET status = '1'"
}
Also try using

Code: Select all

set site [lindex $row 0]
 set section [lindex $row 1]
  set rls [lindex $row 2]
That should send the data to the channel every 10,15,20,25,30 mins ...etc

P.S i dont know the first thing about mysql, n stuff but as i haven't changed anything other than the lindex(s); it shouldn't affect anything mysql related.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

TCL_no_TK wrote:sorry, type'o :roll: *utimer.
Try this:

Code: Select all

proc pub:send_nfo {nick host hand chan text} {
global mysql
 set output [mysqlsel $mysql "SELECT * FROM nfo_cache WHERE status  = '0'" -list]
  set c 10
   foreach row $output {
    set c [expr $c +5]
     utimer $c putserv "PRIVMSG #pre.nfo-feed :!fetch_nfo [lindex $row 0] [lindex $row 1] [lindex $row 2]"
   }; mysqlexec $mysql "UPDATE nfo_cache SET status = '1'"
}
Also try using

Code: Select all

set site [lindex $row 0]
 set section [lindex $row 1]
  set rls [lindex $row 2]
That should send the data to the channel every 10,15,20,25,30 mins ...etc

P.S i dont know the first thing about mysql, n stuff but as i haven't changed anything other than the lindex(s); it shouldn't affect anything mysql related.
You're incorrectly using the [utimer] command.

Code: Select all

utimer $c [list putserv "PRIVMSG #pre.nfo-feed :!fetch_nfo [lindex $row 0] [lindex $row 1] [lindex $row 2]"]
Post Reply