Note: there is no ‘=’ sign (like you used in the first message and there is no ‘$’ before the variable (lanip) you want to change. You can use another variable (with $ before its name) instead of the “1.2.3.4”. And you can calculate the value or get it by other script/mikrotik commands:
I’ve seen the :len argument several times but can’t quite figure out what it does and the usermanual doesn’t help me either. Could you give me a short description?
Thanks for the info! I thought it would mean “length”, but wasn’t 100% sure.
Where could I find a list of all such functions? I looked at the 2.9 manual but theres only a couple of functions.
I’m currently sitting with a problem where my variable isn’t always an integer and have no idea how to fix it. I wrote a loop to search for numbers in the string, but some characters in the variable causes the loop to stop from time to time. I think it could be an “integer devided by zero” error as it only happens to queues with no statistics.
My above script is meant to seperate the tx-upload-bytes and rx-upload-bytes from the “bytes” found in the queue. Perhaps you know of a better way than to loop through the integer, picking values until the value = “/”.
I figured out that the problem was with the value of the variable actually being infinity. So I added this bit of code which seems to have fixed it completely:
It has to be part of you main loop. It checks to see if the variable is smaller than 1000GB, if it is, nothing will happen, if it’s not smaller than 1000GB, it is probably inifinite and therefore the “else” will set it to 0.
I had a whole bunch of if’s inside of each other with log entried to try and figure out where the problem came from, and took out each if command as I know the problem wasn’t there. So I basically ended up with my thingy. Well, Maths was never my strong point!
to get all the commands you can simply enter the start of the command and double tab in console, like:
in cousole you etner : (colon) and
[admin@Mikrotik] > :
environment do for led nothing resolve tobool tonum while
terminal error foreach len parse set toid tostr
beep execute global local pick time toip totime
delay find if log put toarray toip6 typeof
Thats how I’ve been doing it, but I was hoping to find an explination of what every command does too. Is there no other way to find it, or should I just guess and try?