I’ve used AI now and then for writing VBA and PowerShell scripts, often surprised how accurate the code is. Anyone tried it with RouterOS configuration? Will have a go next time I need to do some RouterOS work.
Try our own AI bot. It’s not very good at scripting, because RouterOS is not as popular as generic programming languages, but it’s still pretty good if you can do your own sanity checks, and if you are able to formulate the problem in full sentences with a lot of details:
@robmaltsystems so basically this means “if you are able to formulate the problem in full sentences with a lot of details” MT support will create script for you, not sure about that, but if @normis says so why not to believe
I need to understand more about AI works but do know that it uses a lot on existing knowledge so as RouterOS is relatively niche, there isn’t as much source material for scripting such as for PowerShell. What I don’t know is whether AI understands the syntax of the language and therefore can write any new code.
Not really-really.
The issue is that AI “digests” anything it can find related to the subject without actually checking if what it reads is accurate or not.
Then it re-elaborates on what it has read and the output can be good (if the original digested source was good) or completely bonkers (if the source was shit).
With RoS there is the additional challenge of the (sometimes huge) differences between version 6 and version 7 and what can be found (sources) rarely explicitly specify which is which.
To this you add the “sure” (as if it actually knew what it says) tone that usually characterizes AI suggestions and you get what you get, something almost, but not quite, completely unlike good code…
AI is like virgin who knows all about sex
Thanks for providing this valuable resource … it did help me solve some problems effectively …
Maybe you missed it, but the linked page has a chat bot in the corner. I was not talking about emailing support.
Ah you’re referring to that bot, sry my mistake. (Good I didn’t comment why are support staff treated as bot level intellect )
Called (fantasy must not be one of the good Latvian guys point of strength) “The Dude”, so that it can be more easily confused with the Mikrotik management software.
The good thing is that at least on paper rectius screen it is - unlike many other AI bots - quite modest:
Hi there! >
> I’m a LLM chatbot and I might not answer all questions perfectly, I make mistakes! My knowledge is based on the MikroTik documentation, which you can read here to get more in-depth knowledge.
Write your question in full sentences, this is not a search box.
All AI models fully understand formal syntax descriptions for scripting languages, like standard BNF (Backus–Naur Form) and similar. The real issue is that Mikrotik has never bothered to publish an official BNF for RouterOS v7 scripting, which is necessary to properly train AI models for it.
Why they haven’t already is a big mystery, but IMO they probably lack the competence to understand this.
Check out this thread: Feature Request: Official BNF for RouterOS Scripting
Hi there! >
> I’m a LLM chatbot and I might not answer all questions perfectly, I make mistakes! My knowledge is based on the MikroTik documentation, which you can read here to get more in-depth knowledge.
Write your question in full sentences, this is not a search box.
How to convert string value into boolean type value with ROS script?
You can use the :tobool command in RouterOS scripting to convert a variable to a boolean value. Example:
:local myStr “true”
:local myBool [:tobool $myStr]
:put $myBool
>
> This will convert the string "true" to a boolean value.
This resutls myBool variable with nil value
> To convert a string to a boolean in RouterOS scripting, the string must be exactly "true" or "false" (case-sensitive). Any other value will result in a nil value when using :tobool.
>
> Example:
>
> ```text
:local myStr "true"
:local myBool [:tobool $myStr]
:put $myBool # will output true
:local myStr2 "false"
:local myBool2 [:tobool $myStr2]
:put $myBool2 # will output false
:local myStr3 "yes"
:local myBool3 [:tobool $myStr3]
:put $myBool3 # will output nil
Only “true” and “false” strings are valid for conversion to boolean.
Like I said virgin that knows all about sex
The Dude AI does not abide. It seems to have trouble even know the syntax of :beep — which is pretty regularized in syntax. And, “The Dude AI” really want to insist that argument names are not needed…
So we’re a long way from it playing a piano, http://forum.mikrotik.com/t/piano-interactive-player-piano-studio-quality-recorder-using-beep/173756/1
Yeah, it’s probably because MT picked some cheap or freebie version that can’t really handle much, like Gemini 2.0 Flash-mini or similar.
They could have at least trained their own model with BNF or similar first, so we wouldn’t have to deal with all the nonsense answers (hallucinations). But like I said in my previous post, they probably just don’t have the competence to understand this.
Well at least Perplexity is a bit smarter, it is aware of :tobool bug: https://www.perplexity.ai/search/how-to-convert-string-value-in-MZpO.7rrT.6RAF3KxisA4g#0
Oh geez, it’s actually here the DOCS that are wrong OR BUG in RouterOS.
Upon checking docs…
:beep is actually documented as “:beep ”, which is wrong since its needs “:beep frequency=X length=X”.
RouterOS does have /console/inspect — so they have the data needed for BNF docs, or a lang-server LSP so it have a chance to work with CoPilot-like things. For example, /console/inspect do not show an unnamed parameters (i.e. SYMBOL show as with <> if it was unnamed arg)
/console/inspect request=syntax path=beep
Columns: TYPE, SYMBOL, SYMBOL-TYPE, NESTED, NONORM
TYPE SYMBOL SYMBOL-TYPE NESTED NONORM
syntax collection 0 yes
syntax as-value explanation 1 no
syntax frequency explanation 1 no
syntax length explanation 1 no
Even AI needs CORRECT documentation…
I’m pretty convinced they are using something like Lex/Yacc or Flex/Bison, so it should extremly easy to put together a BNF. You really have to wonder what the actuall problem is, right?
Another major issue, as you pointed out, is the amount of unclear information, outright errors, and missing details in Mikrotik’s documentation. Why not do what many other companies, like Microsoft, have done and add a link for user comments on each help page? They already have the tools for it, so how difficult can it be??
That’s been my long assumption too. I suspect MikroTik could cut-and-paste the presumed Lex/Yacc code into ChatGPT and ask it to generate a BNF. And with BNF, you’re closer to being have some LSP (which is my bigger grip since then any editor could accurately syntax check things)
Agreed. Now I’ll offer if you submit a bug in with "Docs - " in title, MikroTik has been pretty responsive to fix the docs when reported in JIRA. i.e. I just submitted one for :beep’s syntax, SUP-186687.
Since MT already uses Confluence/Jira, they can just publish a link to each page that automatically creates a ticket with a comment. There are also both free and paid add-ons that can create visible comment sections, kind of like the ones you see on Microsoft’s help sites.
100%
Just saying I rather file a ticket, than post a few times on different threads “the docs are wrong”