syntax error in v.6.1

Why is this part of a script no more working in v6.1?

:if ($resolvedIP != $currentIP) do={

I get a syntax error with the “r” in $resolvedIP
highlighted where this always worked in v.5.x

Why is this and how to correct it?

(I hate it when we see major changes in ROS the scripting also changed. How can you ever implement scripting on a wide scale base if they have to be re-written each time you run an ROS update… very bad… :frowning: )

There are no syntax changes in v6.1

You get error because resolvedIP is not defined. Same error you would have in v5.

:local resolvedIP [:resolve "www.speedtest.net"];
:local currentIP [/ip firewall address-list get [find comment="speedtest_net"] address];
:if ($resolvedIP != $currentIP) do={
/ip firewall address-list set [find comment="speedtest_net"] address=$resolvedIP;
/log info "speedtest.net ip updated";
}

This is the full script.
It doesn’t produce an error in 5.24. But it does in 6.1?

But when I put this same script in 5.24 terminal it DOES produce an error! So how do I now know if a script is working or not?

And if it is not, what is wrong with it? I made it in the early days of 5.x series and had it tested and it works fine. I had it implemented in 400+ units so now it maybe it doesn’t even work and I’m not getting any error message of it failing too! pfff

When you paste script in terminal each line is treated as separate script, local variables are not seen from other scripts, so you get an error.

Put script in braces {} and then paste it in terminal. Will work on both v5 and v6.

The script is performed in terminal (I think, it doesn’t produce any errors) but when the same script is performed in the script (I ‘run’ the script) it get “script error: no such item” in the log…

So now it runs in the terminal I have no clue why it is not working in the script section of winbox?
So what to do next?

Script copied and paste from terminal:

/system script
add name=resolve_speedtest.net policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api source=“:local resolvedIP [:resolve "> www.speedt>
est.net"];\r
\n:local currentIP [/ip firewall address-list get [find comment="speedtest_net"] address];\r
\n:if ($resolvedIP != $currentIP) do={\r
\n/ip firewall address-list set [find comment="speedtest_net"] address=$resolvedIP;\r
\n/log info "speedtest.net ip updated";\r
\n}\r
\n\r
\n”

i believe this is a problem introduced in 6.1, and was not present in 6.0.
See http://forum.mikrotik.com/t/changed-script-operation-in-6-1/67141/1 and
http://forum.mikrotik.com/t/802-1x-authentication-working/74/1
for other reports regarding the same issue.

so far i have not heard from Mikrotik whether this is an error that was inadvertently introduced in 6.1, or whether this is a change in scripting requirements. I am hoping that Mikrotik will respond so we can either wait for a fix in 6.2 or else will need to edit / rewrite scripts.

Perhaps someone from Mikrotik will provide direction???