One big trick, I think, is using “/system/script/edit source” to use Mikrotik’s editor. Unlike Winbox’s script editor, it will show red marks if the script is invalid (in realtime in edit).
While I like @rextended, I know he uses notepad.exe to edit script, but without color-syntax coloring he’s crazy. Same with winbox’s script widow. The colors do help.
Take my $PIANO script, if the script is “correct”, you’ll see all the colors indicating types
Even a light red shows [undeclared] args, which is correct here, but using function args is rare, and undecleared variables are normally bad… why $bpm, $silient, etc are red - but still parses so you see colors everywhere).
But throw a bad command into the mix, all colors gone means it cannot be parsed. And if edit cannot colorize it, the script engine would be able run it either:
Now having it all colored does not mean it will “just work”, but at least it won’t be a syntax error that’s the issue.
There are routeros plugins for other code editors like VSCode, etc. too. But I swear the colors really help with these dense RouterOS scripts. But the “/system/script/edit” is actually the most accurate, since it’s using the real script engine. Winbox’s script window does not help you - it more a hope-and-pray it’s right sitution.