mIRC Homepage
Posted By: saxon Locating Error? - 25/03/04 10:18 AM
Hi, I load up an old script today. It's very big, Well over a thousand lines.

mIRC spits out this error in the status window:
* /if: invalid format

Err.. Ok. No line number or script file, That isn't unusual for a mIRC error message. crazy

But the question is, How do i use the new 6.14 error handling to locate this error? Or is it a case of just deleting my old script, Which took avery long time to make. And no, I don't intend to waste my life going throught the file manually :-)

You may of heard the expression "Needle in a hay stack".
Posted By: Cobra Re: Locating Error? - 25/03/04 10:59 AM
a good way to narrow it down would be to search all lines that match * timer* if *

because the only time mIRC wont give a filename and line number is when there isnt one .. like if you type the command into the commandline manualy .. or if its executed by a timer

Cobra^
Posted By: saxon Re: Locating Error? - 25/03/04 12:11 PM
Quote:
because the only time mIRC wont give a filename and line number is when there isnt one .. like if you type the command into the commandline manualy .. or if its executed by a timer


If only that were true crazy

Here's 2 examples off the top of my head where it applies directly to events:

on *:text:*:*:{
ThisIsAnunkownCommand
}

on *:text:*:*:{
echo -a $iif(ischan $target,Yes,No)
}


This first one Unkown command is particularly nasty because it could result from a %variable being evaluated or another reason. Meaning that you simply can't search the file for "ThisIsAnunkownCommand".

There are ones i just thought of, After scripting solidly for a few years im sure there are other situations too.

There is also silly mistakes like this:
on *:TEXT:*:*:*:{
echo -a blah
}
on *:Input:*:*:{
echo -a blah
}

Although those last 2 are silly mistakes and easier to locate it is another example of the parser not reporting script or line number when it knows it full well.

Btw I searched for problems with /timers and the problem doesn't lay there. I take it the new error handling can't track these kind of errors?

Posted By: Cobra Re: Locating Error? - 25/03/04 01:26 PM
the unknown command problem is not an error in mIRC

if a command isnt an internal alias to mIRC, and isnt a scripted alias inside mIRC, then the 'command' is sent to the server .. so in that case there is no error in mIRC .. however there may be an error in your code but mIRC has no way of knowing that, the error you see is sent from the server, and not mIRC

however good point about $iif() .. i hadnt thought of that

if your sure there is no problem with timers .. then the problem probably lies in $iif()

to use mIRC's error handling feature you would have to know which event or alias the error occured in, and even then all it does is alow you to triger the execution of code when the error occures ..

Cobra^
Posted By: MIMP Re: Locating Error? - 25/03/04 04:27 PM
You could if you like go through and add error code to each event/alias that you think may be the source of the error. Example:

alias test {
<commands>
}

alias test {
<commands>
:error
echo -s Error: $error $scriptline
}

By using $scriptline you can figure out which line is actually echoing the error code. From there at least you can narrow it down to one routine. Good luck.
© mIRC Discussion Forums