|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
OP
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
I have a script that I wrote that handles stats in my channel. I set it up so that it can display stats from a user's request and from requesting them for the client with the script (using on INPUT). It works great. However, if I do something like this from the client with the script: !channelstats It shows up as: <Riamus> There have been [color:#33FF33]182,048 visits since September 21, 2003, with a peak of 69.[/color] <Riamus> Those visitors have typed [color:#33FF33]2,366,002 lines in this channel and 2,978 have been kicked out.[/color] <Riamus> During that time, there have been [color:#33FF33]102,226 smiles, 31,234 frowns, and 74,106 laughs.[/color] <Riamus> !channelstats
Notice that the text I typed appeared after the msg lines displayed the stats to the channel. It appears this way on the client with the script and for everyone else in the channel. I assume on INPUT is handling the code before displaying the text you typed in case you want to halt it, but it's a little strange. It's been like this for a long time, but wasn't always like this. A new mIRC version changed it to appear after the msg lines, but now I forget what version it was... probably something around 6.03 or so. Anyhow, I know I could do a workaround where I msg the channel with !channelstats followed by the msg's for the stats and then halt my text. It will appear first that way, but I shouldn't have to do it like that. Does anyone know why it does this or have a suggestion on how to prevent it from doing that?
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
It does that because that's the order in which you're telling mIRC things should happen. on INPUT always triggers before the text is sent, so sending anything else before the event ends will result in that appearing first. I don't know anything about it not working like that in the past, but then I don't use on INPUT very often. As you said, it's an extremely easy fix for your code so there's really not an issue.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Feb 2006
Posts: 546
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 546 |
don't know which you find easier but if you'd prefer not to have to haltdef etc. you could always put those messages on a 0 delay timer so they're sent just after the event ends (and the original text is sent)
"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
OP
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Good point. Wasn't thinking of a timer.
Ok, that works well. However, is there some reason why the timers work in reverse?
In the on INPUT event,
.timer 1 0 msg $chan this .timer 1 0 msg $chan that
Will display:
that this
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2006
Posts: 546
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 546 |
yeah if i remember right there was a big discussion about the order in which timers with the same delay are executed, which is why the -d switch was added
//tokenize 32 a b c d e f g h i j | .timer -hd 1 0 echo -a $*
a combination of the h and d switches will do the trick
"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
Hmm. Does that mean that //tokenize 32 a b c d e f g h i j | .timer -d 1 0 echo -a $* is buggy, since it doesn't match what is stated in the helpfile: "The -d switch ensures that a timer and any subsequent timers using the -d switch are triggered in that order." ? Or is that to do with how $* is being handled??
Sais
|
|
|
|
Joined: Feb 2006
Posts: 546
Fjord artisan
|
Fjord artisan
Joined: Feb 2006
Posts: 546 |
yeah that's what i thought when i saw it, but if you look at:
//tokenize 32 a b c d e f g h i j | .timer -d 1 1 echo -a $*
that retains the order so it seems -d doesn't handle tiny delays well unless you use -h ;S
"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
I'm still not sure that it's not a bug (note the double negative I don't pretend to know what the implementation of the timers might be, but I guess getting the 'expected' behaviour is more difficult than I'm imagining
Sais
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
OP
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
As long as I can force the expected behavior, I'm happy. Though, it would be nice to have the timers go off in the right order to begin with.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
As someone mentioned above, Khaled did "fix" the timer order bug, but in doing so, ALL timers became much slower in reacting. I believe it was decided that the order of execution of the timers wasn't absolutely important for most cases, so the mandatory order was removed, but the -d switch was added to enable the high importance orders to be maintained when necessary.
-genius_at_work
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
I still don't see why timers are being used at all. The easiest and most effective solution here was the addition of two lines: msg $chan !channelstats
...stats msg's here...
haltdef
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
OP
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
As I stated, that was an option, but I was looking for another method. I didn't want to halt my normal input text just for that.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
The haltdef would obviously go in the same conditional block that checked for the presence of the "!chanstats" command. It wouldn't effect any other input. But hey, whatever works for you.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
OP
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
I check a lot of commands... adding that to every command I might type would increase the length of the script more than I'd like.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
|