So I got the script to work. I had to add a line after the "unset %msgcounter" from your script, otherwise the %msgcounter variable simply continued adding since it's last variable number.

Code:
set -u1 %msgCounter On


So I think it's working flawlessly now. Thanks again for the help. smile