What they said, but also...
With mIRC it's not suggested to use the while statement like you have it. We usually just use while for loops.
For instance:
var %x = 1
while (%x <= $chan(0)) {
inc %x
}
Also, since your text event specifies the text has !check in it, (!check isin $1) is uneccesary. It would be better to remove the 1st wildcard in the event.
on *:text:!check*:#:{
}
Remember this will only trigger if the first word is !check so the rest of your code wouldn't work. You can just make the text a wildcard, then check for $1.
on *:text:*:#:{
if ($1 = !check) { ;commands }
elseif ($1 = wolf) {
if ($2 = NXwolf) msg # test complete
}
}
Also,
{ { /msg #Wolfscripts test complete } }
There is no need for the double brackets.

In the event of a failure:
You can say:
if (this = $true) do this
elseif (this = $true) do this
else { ;planned for error }
Also, you can utilize :error. This would be at the end of the code block.
:error {
echo -s Error: $error
reseterror
}
Error handling
Script errors can be caught by adding an :error goto point to your script. When an error occurs, the script will jump to :error and continue running. $error returns the error message.
You can reset the error with /reseterror. If you don't reset the error, it will propagate backwards to any calling aliases until an :error is found and will halt the script as usual.