Thanks Valery. That's quite useful actually, I never thought that it's even available (talking about line 6 in your script).
I have one more question I could not solve alone. I've found the script of Snort which was allowing to build new mines:
http://nekaka.com/d/LuwUsmOBMz
But people say script has no ers/ert files and is laggy. Thats why I did not risk to put it ingame.
Is there any way to make it working same way as Conquistador mod script of building towns? I.e. won X fights and got ability to build a mine by your choice. Or just to keep it working like scriptmaker meant it to be, but to fix bugged parts if they exist.