It looks like the answer is “sort of”.
This is legal:
function myfunc(){
return 7;
}
if(myfunc() == 7){
this.moveXY(38,44);
}
If you want your function to call a method or property that would normally require “this”, you’ll need to pass in a reference to the appropriate thang:
function myfunc(thang){
thang.moveXY(38,44);
}
myfunc(this);
with API protection turned off, you can probably also get away with:
this.myfunc = function (){
this.moveXY(38,44);
};
this.myfunc();
However, it does look like levels that use plan() instead of chooseAction() might not handle functions properly, probably due to the whole “planable methods” thing.