A great way to become comfortable with UDFs is to download the KixDev package from our web site and use KGen. KGen does two things for you - it examines your script and identifies references to external UDF files, including them automatically in a finished script. It then runs Sanity, which checks your script for common errors such as doubly-defined or undefined variables, mismatched quotes and parens, and unbalanced paired functions (like If/EndIf).
KixDev includes several sample UDFs, and our entire development library is published every night to our web site, so the latest versions are always available online. KGen works with any UDF file, and as was mentioned, the entire KORG UDF library is indexed at http://www.kixtart.org/udf.
With KixDev and KGen, you create a folder to hold your UDFs, and define that path in the KIXLIBPATH environment variable. Create your script as a .TXT file - myscript.txt - and reference any UDF from your library when you write your script. You don't have to worry about INCLUDing or CALLing the UDF file. You can also break larger projects into smaller, managable UDF files within a single project folder.
Run "KGEN myscript" and it will identify all of the available UDFs in the library and the local project folder, examine your script, and resolve all UDF dependencies and generate a complete script. In addition to generating a finished script, KGen will create several log files that aid in debugging or documenting your script project.
Comparing your .TXT file with the resulting .GEN file will illustrate how UDFs are used within kix. (The .GEN file is a clear-text file with all comments - KGen can strip comments or tokenize the final script.)
We use KGen for nearly every one of our Kix scripting projects, and some of our projects exceed 15,000 lines of code.
Glenn
_________________________
Actually I
am a Rocket Scientist!