mIRC Home    About    Download    Register    News    Help

Print Thread
$hfind/$findfile/... not giving line # on error #264719 06/01/19 04:44 AM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
When an error is generated from the command parameter of these ($finddir not tested but most likely included), the line number and script file for the error is not provided:

$hfind(1,*,0,w,if () ) or $findfile(.,*,0,if ($inrect(1,2,3)) noop )



Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $hfind/$findfile/... not giving line # on error [Re: Wims] #264720 06/01/19 01:27 PM
Joined: Dec 2002
Posts: 4,588
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,588
Thanks for your bug report. I have not been able to reproduce this issue yet. If I place your $findfile() example in an alias in a script and call the alias from the editbox, it reports an error with the script name and line number.

Re: $hfind/$findfile/... not giving line # on error [Re: Khaled] #264721 06/01/19 05:22 PM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
It may be related to my usage of bracket, I thought any kind of script error would do it.


The functionnal line of code:
Code:
noop $hfind(rr,i*,0,w,if ($inrect($mouse.x,$mouse.y, [[ $hget(rr,$1) ]] )) noop)


What triggers the issue (invalid parameters: $inrect) is:
Code:
noop $hfind(rr,i*,0,w,if ($inrect($mouse.x,$mouse.y,[ $hget(rr,$1) ])) noop)

So:
Code:
alias testerror {
  hadd -m rr i1 0 , 0 , 0 , 0
  noop $hfind(rr,i*,0,w,if ($inrect(0,0,[ $hget(rr,$1) ])) noop)
  :error
  hfree rr
  if ($error) {
   reseterror
   echo 4 -s from /testerror:  $v1
  }
}
This reproduce the issue for me, I'm on 7.53 and not 7.54 for some reasons.

Last edited by Wims; 06/01/19 08:11 PM. Reason: tested on 7.54.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $hfind/$findfile/... not giving line # on error [Re: Wims] #264724 07/01/19 02:13 AM
Joined: Jan 2004
Posts: 1,229
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,229
It's happening in 7.54 also. It happens for $hfind but I can't make it happen for $findfile or $finddir. When this glitch happens, it's falling through to the next line with $error defined without mentioning a line number, instead of jumping to the :error label.

Code:
alias testerror {
  echo 5 -a beginning value of $ $+ error is: $error
  ; echo -a $null 
  ; noop  $findfile(.,*,0,1,if $false noop)
  ; noop  $finddir(.,*,0,1,if $false noop)
  noop     $hfind(rr,i*,0,w,if $false noop)
  echo 6 -a falling thru. this will not contain a line number: $error
  :error
  echo 3 -a entered :error at line $scriptline with $ $+ error set to: $error
  if ($error) {
    reseterror
    echo 4 -s from /testerror:  $v1
  }
}

Re: $hfind/$findfile/... not giving line # on error [Re: maroon] #264725 07/01/19 03:10 PM
Joined: Jan 2004
Posts: 1,229
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,229
Sorry. I still had the hashtable in memory from the prior alias, and shouldn't have taken the line

hadd -m rr i1 0 , 0 , 0 , 0

... out of the alias. One you add this line to the beginning of my version of the alias, the error without the line number happens again. The trigger was an error within the $hfind command, not with $inrect specifically.

Re: $hfind/$findfile/... not giving line # on error [Re: maroon] #264793 12/01/19 11:17 AM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
I mistested using the editbox for $findfile, that's why it didn't have line numbers etc. But you found a different issue here, it should not call the '/echo 6 -a' line after the error. Though, this may be the same issue internally.

Khaled: Can you reproduce?


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $hfind/$findfile/... not giving line # on error [Re: maroon] #264817 14/01/19 09:59 AM
Joined: Dec 2002
Posts: 4,588
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,588
Thanks, I was able to reproduce this issue. In this case, $hfind() was coded so that it would not halt a script if there was an error in the alias call. I cannot see how this would be useful, so I am going to assume it is a bug. This has been fixed for the next version.