I am a newby to RouterOS and have been trying various examples from this forum
and other areas of Mikrotik’s documentation. It seems that few of the scripting examples
I have found there work as is with out a bunch of (painful) debugging to change some
element or variable (name usually) to make it work. Is the documentation/examples
very out dated or something?
Are other people finding this true for them?
If not, what am I missing?
The page which has the scripting documentation and examples have been updated on
Feb. and Aug. of 2016 according to the dates at the bottom of the pages. Is this new
enough for the current RouterOS.
Mikrotik has been changing some variable names of things in Queues that seem to be
a problem in script examples I have found. An example is “target-addresses” doesn’t
seem to work as shown in examples.
A tough issue is if a script has a problem it is not made clear to the writer. The only way
I have figured out is to do the “/system script print” which dumps all of the scripts out to
the terminal with possible syntax errors high lighted with a colored square.
Also, the terminal acts funny when typing, I have completion turned off but there seems
to be a mess up with the cursor position and editing what is under it in the command line.
I am using Winbox on Linux as well as Firefox/Linux to work with the router. The terminal
in Firefox seems to work better but is slow and does not scroll at the bottom so you have
to keep using the mouse scroll button to move the lines up… not as useful as it could be.
If you find any script in manual section that does not work, then let us know.
Other examples that are not in manual section are user created and can be outdated.
Sure will. However, the big question I see is the manual for scripting updated fairly close to new releases of the entire
firmware package? That’s what I suspect that it may be close to current but not reflect some recent changes until several
updates go by then someone visits the manual pages to update them. The ‘change log’ doesn’t comment on the scripting
engine changes as far as I can see.
The scripting manual doesn’t really have a discussion of how it relates to the bulk of the firmware in that there are hundreds
of variables that can be programmed or manipulated and just what there exact names are. Rather the manual gives what is
needed to write control scripts and create variables and deal with some I/O items. An example would be all of the sub-set
of variables that pertain to Queues, the one in particular I mentioned “target-addresses” as used in some example scripts.
I run these and get nothing in the logs or in a terminal.
They just seem to not actually run even though the ‘run-count’ increments. I did see that if one issues ‘print’ in the /system
scripts mode the scripts are listed and various things can be learned about what might be wrong that stops the script engine
from running fully on it. I considered that to run some of the example scripts there must have been a certain setup on the
authors router which may have allowed the script to run correctly, however little of this is provided in the text write up that
accompanies the script.
Example: Limiting a user to a given amount of traffic II
Code: :if ([/queue simple find target-addresses=(“192.168.1.” . $i)] != “”) do={
I have evaluated that the ‘find target-addresses=’ stops the script. I further eventually figured out that maybe I have to
have my queues named the IP address for them to be ‘found’ by the above code, not sure, not clear at all. Just what is target-addresses anyway? The script find operator expects two strings as arguments, so target-addresses must be one of them? Where is the other?
Hope this helps explain what I’m asking and wondering about!