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 

blind time.

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


Joined: 18 Jan 2009
Posts: 16

PostPosted: Tue Apr 20, 2010 5:53 pm    Post subject: blind time. Reply with quote

Hi, i want to blind time every 4 sec. how do i do it?

bind time -|- {* * * * *} proc_update

i dont how to set second. please help
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Apr 20, 2010 6:09 pm    Post subject: Reply with quote

The time binding's resolution is down to the minute, so you cannot use that for anything shorter. The most common approach is to use recursive utimer calls:

Code:
proc someproc {} {
  #payload here...


  #now for the recursive calling:
  #First check for existing timers...
  if {[lsearch [utimers] "* someproc *"] == -1} {
    #No timers left, start a new one
    utimer 4 [list someproc]
  }
}
someproc

This is a rough skeleton, with a few shortcuts. The check for running timers could probably be prettier, but should do the trick as long as you don't use very complex proc-names..
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
c0re
Voice


Joined: 18 Jan 2009
Posts: 16

PostPosted: Wed Apr 21, 2010 3:39 am    Post subject: Reply with quote

Thank you for your quick reply.....

Code:

proc livefeed {} {

  set pagina "my url"
  set http [http::config -useragent mozilla]
  set http [http::geturl $pagina -timeout [expr 1000 * 10]]
  set html [http::data $http]
  foreach line [split $html "\n"] {
  putlog "upgrading livefeed."

  if {[lsearch [utimers] "* livefeed *"] == -1} {
    #No timers left, start a new one
    utimer 5 [list livefeed]
  }
}


question is how do i bind it? with timer or something?
Back to top
View user's profile Send private message
c0re
Voice


Joined: 18 Jan 2009
Posts: 16

PostPosted: Wed Apr 21, 2010 3:45 am    Post subject: Reply with quote

i figured it out and its work just great.....


Code:
proc livefeed {} {

  set pagina "my url"
  set http [http::config -useragent mozilla]
  set http [http::geturl $pagina -timeout [expr 1000 * 10]]
  set html [http::data $http]
  putlog "upgrading livefeed."

  if {[lsearch [utimers] "* livefeed *"] == -1} {
    #No timers left, start a new one
    utimer 8 [list livefeed]
  }
}
livefeed


Thank you so much....
Back to top
View user's profile Send private message
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