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.

Question about interrupting a script

Old posts that have not been replied to for several years.
Locked
-
-W0kk3L-
Voice
Posts: 24
Joined: Sun Feb 23, 2003 7:23 pm

Question about interrupting a script

Post by -W0kk3L- »

Here i am again, with a small question. I don't know if it's possible, so i will ask the wise men and women :)

I've got a script running which does a SQL query. The query returns (or can return) a large amount of data (like 10 to 20 lines of data) to the IRC channel. Is it possible to implement a command, like !stop or so, which stops the output flow the minute it is typed? (So it doesn't continue the whole flow).

I'm not sure if it can be done, because of the flood-protect of the eggdrop. I'm running the eggdrop on Quakenet (so if i flood too fast, the bot will be killed.... that's a stop too, but not the one i want :D).

Thnx in advance for answering this question :)
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Code: Select all

bind pub n !stop stop:something

proc stop:something {n u h c t} {
  clearqueue all
  putserv "NOTICE $n :Stopped all queue messages."
}
Ofcourse this will not work if the bot has already send everything to the server and the server is queueing the message
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Would work if he's using the slowest query (puthelp) to output the data.
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

you could also use a max number of lines setting.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

MeTroiD wrote:

Code: Select all

bind pub n !stop stop:something

proc stop:something {n u h c t} {
  clearqueue all
  putserv "NOTICE $n :Stopped all queue messages."
}
Ofcourse this will not work if the bot has already send everything to the server and the server is queueing the message
what's "clearqueue"?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

clearqueue <queue>
Description: removes all messages from a queue. Valid arguments are:
mode, server, help, or all.
Returns: the number of deleted lines from the specified queue.
Module: server
[/code]
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

okay, but it's irrelevant to that guy's problem; I presume he meant output a result as soon as it has been fetched from db - which means he has a lengthy fetch loop - and you can't interrupt that loop (not without using TCL's threads extension)

of course, if the output is pre-fetched, your solution might work (if the pace of the output is slow enough to be interruptable by triggering pub bind)
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

if you fetch the output from sql and put it via putserv/puthelp it will be filled within a few milliseconds in the server/help queue. so if you clear the queue, the output is interrupted. where the logical problem? the function cant be still running while the output is beeing actually send to server, it would stuck the bot :D.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked