UDFs can be put into the main script as is expalined in the FAQ Forum.

You should also capture function results into return variables in order to suppress console output, also explained in the FAQ forum.

What is the error code of the failing script line? Put error checking in place to track it down, e.g.Code:

? 'Error '+@error+' - '+@serror


or use DEBUG ON.
_________________________
There are two types of vessels, submarines and targets.