Another thing is that when putting scripts directly into XML, you have to be aware that Greater-than and Less-than symbols < > have special meaning, so they must be "escaped" using < and >.
That means lines like:
IF# %NEWFANSPEED% <= 9 GOTO TOOLOW
IF# %NEWFANSPEED% >= 51 GOTO TOOHIGH
need to be slightly modified when entered DIRECTLY into the XML as:
IF# %NEWFANSPEED% <= 9 GOTO TOOLOW
IF# %NEWFANSPEED% >= 51 GOTO TOOHIGH
so that the XML parser can properly read it in, and it will translate the special codes (special to the XML parser, not the Script engine) before MXM passes it on to the Script engine.
Of cours,e when running this as an .XAS file, you won't have this problem (no translation is done, or needed on those particular characters, because the XML parser is not involved)