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.

Run function every X seconds?

Help for those learning Tcl or writing their own scripts.
Post Reply
c
cimeran
Voice
Posts: 9
Joined: Fri Mar 04, 2011 11:52 pm

Run function every X seconds?

Post by cimeran »

Hi folks. New to eggdrop and appreciate any help.

Goal: to monitor an RSS feed and post new items as quickly as possible to a channel.

Found an rss tcl script or two that does what I need, but I'd like to set it to run the required function every x seconds instead of every x minutes (bind time line).

This possible in eggdrop? Of course if anyone has a better idea of how to implement this I'm all ears.

Thanks in advance and I hope this is the correct forum to post to.
c
cimeran
Voice
Posts: 9
Joined: Fri Mar 04, 2011 11:52 pm

Re: Run function every X seconds?

Post by cimeran »

Whoops, found what I needed. From the Eggdrop FAQ I changed...

Code: Select all

if {![info exists myproc_running]} {   
    timer 20 myproc                      
    set myproc_running 1                 
  }                                      
                                         
  proc myproc {} {                       
      # your stuff here ...              
      # ...                              
      timer 20 myproc                    
      return 1                           
  }
...to use "utimer" instead of timer.
User avatar
caesar
Mint Rubber
Posts: 3777
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

How often is that RSS feed being updated?
Once the game is over, the king and the pawn go back in the same box.
c
cimeran
Voice
Posts: 9
Joined: Fri Mar 04, 2011 11:52 pm

Re: Run function every X seconds?

Post by cimeran »

caesar wrote:How often is that RSS feed being updated?
A few times a minute. The big thing is that we have to get from the rss feed to the room as quickly as we can. The utimer is set to 10 seconds right now and it seems to be running okay.
User avatar
caesar
Mint Rubber
Posts: 3777
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

A few times a minute? What's that feed about?

There's no need to fetch the rss if it isn't updated any sooner, cos you will end up stressing out the server that hosts the feed and you will get banned sooner or later (only if it isn't your server). :)
Once the game is over, the king and the pawn go back in the same box.
J
Jagg
Halfop
Posts: 53
Joined: Sat Jan 24, 2004 11:32 am

Post by Jagg »

@cimeran
How do you check the rss feed for new entries and only let the bot post the new ones? I'm also interested in such a script. Thanks
c
cimeran
Voice
Posts: 9
Joined: Fri Mar 04, 2011 11:52 pm

Post by cimeran »

I'm using the rss-synd script on the tcl script archive. It caches the last instance of the file and only posts the new items. Search for it and I'm sure you'll find it.

As for the other question, it's a news feed that needs to be close to instantaneous. We own the server so no possibility of getting banned.
Post Reply