First of all you would have to give an example of what you're doing.
Perhaps the script can be rewritten to be much faster.
In various cases though there is just no preventing mIRC from becoming unresponsive until the script has finished.