I upgraded over 50 routers and found out that none of my scripts are working. ![]()
I guess it will be a long night adapting them to the new RouterOS version 5.x. ![]()
Well, well. I might learn something in the process.
Take this simple script for example, why isnโt working in RouterOS version 5? ![]()
:local T 784,300ms,1047,300ms,262,150ms,1047,150ms,\
1319,300ms,784,300ms,1047,300ms,262,150ms,392,150ms,\
1047,150ms,523,150ms,1319,150ms,392,150ms,1175,\
300ms,294,150ms,1175,150ms,1047,300ms,988,300ms,\
1047,300ms
:for C from=0 to=(([:len $T]/2)-1)\
do={:beep frequency=[:pick $T ($C*2)] \
length=[:pick $T (($C*2)+1)]; :delay [:pick $T (($C*2)+1)]}
Removing all line joining backslashes before the for command actually makes this thing working. โDโoh!โ
Adding parentheses around the first part of the script is a better solution, itโs not a good idea to have the entire script in one single line.
:local T (784,300ms,1047,300ms,262,150ms,1047,150ms,\
1319,300ms,784,300ms,1047,300ms,262,150ms,392,150ms,\
1047,150ms,523,150ms,1319,150ms,392,150ms,1175,\
300ms,294,150ms,1175,150ms,1047,300ms,988,300ms,\
1047,300ms)
:for C from=0 to=(([:len $T]/2)-1)\
do={:beep frequency=[:pick $T ($C*2)] \
length=[:pick $T (($C*2)+1)]; :delay [:pick $T (($C*2)+1)]}
Okey, final script after some modifications. Now, over to some more important production scripts.
:local myVar \
"784,300,300,1047,300,300,262,150,150,1047,150,150,1319,300,\
300,784,300,300,1047,300,300,262,150,150,392,150,150,1047,\
150,150,523,150,150,1319,150,150,392,150,150,1175,300,300,\
294,150,150,1175,150,150,1047,300,300,988,300,300,1047,300,0"
:set myVar [ :toarray $myVar ]
:for i from=0 to=( [ :len $myVar ] - 3) step=3 do={
:local freq [ :tonum [ :pick $myVar $i ] ]
:local length ( [ :tostr [ :pick $myVar ( $i + 1 ) ] ] . "ms" )
:local pause ( [ :tostr [ :pick $myVar ( $i + 2 ) ] ] . "ms" )
:put ":beep frequency=$freq length=$length"
:beep frequency=$freq length=$length
:put ":delay $pause"
:delay $pause
}