I think this command should print an error instead of just blindly setting 0 if someone makes a typo.
//setlayer a | timer 1 5 setlayer 255
Thanks for your bug report. Technically, this is standard behaviour across the scripting language and in most features. While some commands and identifiers will report an error if you try to use text instead of a number, the majority will simply try to extract a number from the parameter that you provide. If it happens to be text, it will return zero.
For this command, evaluating text as if 0 can make it difficult to get back into your client after this scripting error.
//var %setting 128 | !setlayer %setting $chan(1) | timer -o 1 10 !setlayer 255
If the 128 is deleted, the $null %variable causes the first setlayer command to be seen as "setlayer #channel" which is evaluated as if "setlayer 0" against the main window.