Scripting problems after ros2.x upgrade to ros3.0?

Amongst some others, the following script stopped working after upgrading PC based router fm 2.9.x to v3.0

/system script print from=check-gateway-one
Flags: I - invalid
0 name=“check-gateway-one” owner=“adminrudy”
policy=ftp,reboot,read,write,policy,test,winbox,password,sniff
last-started=jan/21/2008 02:40:43 run-count=1699
source=
:if ([/ping 66.249.91.103 count=4]>2)
do={:set gw1 0}
else {:set gw1 1}

Has the scripting syntax changed for rosv3.0? Is this documented somewhere. I found more scripts of me not working anymore.

In the terminal I see all colours, in the above example the "do={:set gw1 0} " line has the letter “g” blocked in red now. Is this a sign it is an error?
I also see colors blue, pink etc. what is the meaning of these?
Any info on this?

Rudy

Documentation is not ready yet. But main changes you can read from changelog.

Your script isn’t working because variables should be defined before usage.

:global gw 0;
:if ([/ping 66.249.91.103 count=4]>2) do={:set gw1 0} else {:set gw1 1};

The variables are already set in another script that runs before this, this worked before in ros 2.9.x??

The other script reads:
:global gw 0
:global gw1 0
:global gw2 0

So, what’s wrong?

Rudy

It doesn’t matter if you have set value in another script. Variables must be defined in each script.

For example you have one script:

:global myVar 0;
:set myVar 333;

Now if you want to read myVar value in another script you should do like this:

:global myVar;
:put $myVar;

This syntax is just like in most of programming/scripting languages.

hmmm, I see.
I´m going to try your suggestion later today.
The strange thing is only that it worked perfectly under 2.9.x os. But maybe the new rosv3.0 is a bit more tight.

Rudy

Yes, in 2.9 it worked without variable definitions. This feature is added in 3.0.