Ideally, you want to eliminate the errors so that your commands work across all routers. For the code giving you problems, you could use a script to detect the RouterOS version and then execute the version specific commands:
if ([:pick [/system resource get version] 0] <= 3) do={
code here for v3 or earlier...
} else={
if ([:pick [/system resource get version] 0] = 4) do={
code here for v4...
} else={
if ([:pick [/system resource get version] 0] = 5) do={
code here for v5...
} else={
code here for any other version (6 or greater)...
}
}
}