[Scripting][vm] Added a lot of code to the run script function.