But how i would know in advance in what order the commands will be in the script source?
Impossible.
For ex: script
cls print "test 1" print "test 2"
I have to write "cls" struct once, and then "print" twice.
In same order. The order could be anything. Because its compiler. And user can write this in any order.