Put the output of a command in a variable
Unlike expression functions, HScript commands are not functions and do not have return values. They just print output to the textport. If you try to assign the result of a command to a variable, as in:
set objects = opls /obj
…you’ll just get the string "opls /obj" in the $objects variable. However, you can capture the output of a command as a string and put it in a variable to achieve the same effect. To capture the output of a command, put it inside a run expression function and then use backquotes to evaluate the expression in HScript. Essentially, you're calling HScript inside an expression (to get a return value) inside HScript.
set objects = `run("opsls /obj")`
echo $objects
model ambient1 light1 light2 light3 cam1