Why use "if (%stb == %totbu) { halt }" at all? The while statement will automatically stop when %stb equals %totbu since that *is* your while statement.
As mentioned, what you have there is unnecessary as your WHILE statement will automatically complete when those are equal. Beyond that, if you *did* want to halt the full script, you'd want to use RETURN instead of HALT, like you did previously. Or, if you just want to stop the WHILE loop, but want the script to continue running, then use BREAK.