Last MTOS used 2.9.42+ now trying 3.3 and scripts broken

Hi,
I have been out of touch with OS changes since 2.9.42, and I just installed a router with 3.11, but I am finding that some of my scripts are breaking. I originally donated the backup script and scheduler code to the wiki way back and now I am having a syntax problem.

Where is an updated scripting guide? I do not see one in the v3 documentation.

It looks like I am having a syntax problem when using variables

I used to write something like {:if ($a <= 1) do { whatever I want }

now I get an error at column 7 The variable “a”

Any ideas what the syntax change is?


There is also another syntax error I found in the statement -

do {:foreach i in=[/ip hot pro find html-directory=hotspot] do={/ip hot pro set $i html-directory=hotspotnoauth};

It does not like “[” in the line above for some reason.

Any ideas? Thank for helping me save some time…

I used to write something like {:if ($a <= 1) do { whatever I want }
now I get an error at column 7 The variable “a”

You have to declare “a” before using it in script.

  :global a;
  :if ($a <=1) do={ .... }



:do {
  :foreach i in=[/ip hot pro find html-directory=hotspot] do={
      /ip hot pro set $i html-directory=hotspotnoauth;
   }
}

works for me