mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2003
Posts: 38
O
Olathe Offline OP
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Sep 2003
Posts: 38
if an on sockclose event takes a long time to execute, it will be called twice, possibly leading to errors when the event isn't designed to run twice in a row.


alias test sockopen test www.yahoo.com 80
on *:sockopen:test:{
sockwrite -tn test GET / HTTP/1.0
sockwrite -t test $str($crlf, 2)
}
on *:sockclose:test:{
TestAsk
}
alias -l TestAsk echo 4 -a $?


The use of an alias to use $? is just to make a short, easy-to-understand example.

Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Confirmed here.


* cold edits his posts 24/7
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
How long a time are you talking about? I couldn't reproduce this (WinXP) so I added a little to the code to show time taken

on *:sockclose:test:{
set -u %testask $ticks
TestAsk
}
alias -l TestAsk echo 4 -a $? - $calc(($ticks - %testask)*.001) seconds.

These are the results, there were no doubleups.
how long? - 10.797 seconds.
a bit longer.... - 19.938 seconds.
shorter - 1.156 seconds.
long enough yet? 27.921 seconds.


Joined: Dec 2002
Posts: 349
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 349
I think this is an issue with mIRC allowing $? to be used in the event, the help file makes it very clear that $?/$input can not be used during a script event.

Are you able to reproduce the bug without $? ?

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
This bug also occured to me when I tested my /sleep and /xrun, that use a COM object to delay mIRC, before submitting them to ms.org. This is the note I eventually added, to inform users of this behavior:
  • When calling /xrun from an event, expect error such as the event being called twice. One way around this is creating an alias that contains your commands and calling it from the event via /timer 1 0 <alias>


Link Copied to Clipboard