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.
A careful use of timers usually does the trick. If that fails you can use the sleep alias. Though, most consider it bad coding to need to resort to it.