Community discussions

MikroTik App
 
User avatar
hecklertm
Member Candidate
Member Candidate
Topic Author
Posts: 165
Joined: Fri Jun 24, 2005 5:12 am
Location: US

Last MTOS used 2.9.42+ now trying 3.3 and scripts broken

Sun Jul 20, 2008 8:12 pm

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...
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Last MTOS used 2.9.42+ now trying 3.3 and scripts broken

Tue Jul 22, 2008 5:37 pm

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

Who is online

Users browsing this forum: diamuxin and 15 guests