Community discussions

MikroTik App
 
jowi007
Member Candidate
Member Candidate
Topic Author
Posts: 110
Joined: Thu Oct 13, 2005 11:07 am

Migrating script from 2.9.x to 5.x

Fri Dec 17, 2010 8:58 pm

:local traf;
/queue simple
:for i from=1 to= 254 do = {
:if ([/queue simple find target-addresses=("172.18.1." . $i)] != "") do={
:set traf [get [find target-addresses=("172.18.1." . $i)] total-bytes]
:if ($traf >262144000) do = {
set [find target-addresses=("172.18.1." . $i)] max-limit=16000/64000 limit-at=16000/64000
}
}
}

This script is on RouterOs 2.951 what i should change
to make it work on version 5.x

Thanks in advance
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7042
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Migrating script from 2.9.x to 5.x

Mon Dec 20, 2010 8:21 am

{
 :local traf;
 /queue simple
 :for i from=1 to= 254 do= {
  :if ([/queue simple find target-addresses=("172.18.1." . $i)] != "") do={
   :set traf [get [find target-addresses=("172.18.1." . $i)] total-bytes]
   :if ($traf >262144000) do= {
    set [find target-addresses=("172.18.1." . $i)] max-limit=16000/64000 limit-at=16000/64000
   }
  }
 }
}
Scripting syntax of v5 is in the manual:
http://wiki.mikrotik.com/wiki/Manual:Scripting
 
xezen
Long time Member
Long time Member
Posts: 628
Joined: Fri May 30, 2008 10:23 am
Location: South Africa

Re: Migrating script from 2.9.x to 5.x

Mon Dec 20, 2010 8:23 am

hmmm reading reading reading
 
User avatar
THG
Member
Member
Posts: 472
Joined: Thu Oct 15, 2009 1:05 am

Re: Migrating script from 2.9.x to 5.x

Mon Dec 20, 2010 1:14 pm

This script is on RouterOs 2.951 what i should change
The only error I saw was this one:

Wrong:
do ={
Correct:
do={
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Migrating script from 2.9.x to 5.x

Mon Dec 20, 2010 1:35 pm

you should consider that scripting became more strict in later versions, so user do not have several syntactically similar sentences that result in different behavior from expected.

As i have written before, when migrating scripts, create new script in desired version and edit it in CLI, where you can have decent markup of whole script with errors displayed either by red or lack of marck-up
 
sda
just joined
Posts: 14
Joined: Sun Mar 20, 2011 9:27 am
Location: Lesvos - Greece

Re: Migrating script from 2.9.x to 5.x

Fri Mar 09, 2012 8:07 pm

you should consider that scripting became more strict in later versions, so user do not have several syntactically similar sentences that result in different behavior from expected.
Where can we find an UPDATED wiki on your scripting language? as most scripts found just about everywhere are for ancient versions
How about an application to convert those scripts to your latest versions (v2.XX to v5.xx)

Thank you advance

Who is online

Users browsing this forum: No registered users and 16 guests