If you need to determine the settings dynamically, through Javascript, you should prepare config as JSON, and insert the <script> through JavaScript.
For example, the following VAST ad is autoplayed only if the current second (when the code executed) is even. Also, note that we can even override the video to cover with attachTo.