My suggestion would be to debug your script.
Generally, if mIRC crashes/etc, its a DLL.

Here are some hints on how to debug your script:

Add this to everyplace where you loop, call a DLL, deal with big files, etc.
Code:
if (%debug) {
  _debug $+([,$script,:,$scriptline,]) $+(%,var) = xxx
  ...
}

And an alias:
Code:
alias _debug {
if (!$window(@debug)) {
window -e @debug
}
echo @debug $timestamp $1-
}

This way you can just to /set %debug 1 and it does. You can also do "_debug Matching wildcards.." "_debug $v1 iswm $v2 $+ : True/False" "_debug Done matching wildcards." to make it easier to debug.

Make it easy to read the code, use ()s in if statements, and {}s after statements.