That's exactly what I've been doing (minus the END DEF, which I believe is wrong). I couldn't even get the doc's examples to work. I did manage to get them working with the DEF FUNC ARG1,ARG2,... OUT X,Y,... definition but it forces me to write the return value to a variable.