KSP Scripting (NI Kontakt) :: BASICS :: The Kontakt Script Editor

To start scripting

start Kontakt and create a new instrument

click on the wrench symbol

click on “Script Editor” and then “edit”

in the window below there goes your code

The Script Tabs

You can use all the 5 tabs to create independent UI’s or to separate different scripts (for better clarity). But be careful the code inside different tabs is not really independent from each other. There are commands or callbacks which are affecting each other (like the on note callback).

Executing your Script & Error Reporting

When you hit the apply button your script gets executed immediately.

However if there are any errors, Kontakt will not execute the script but report the first error with a status message below. It also marks the affected line of code. However it will not report all kind of errors. Eg. it doesn’t show runtime errors. Furthermore you will probably find the whole error reporting and debugging very nerve-racking. The automatic warnings are still a good help though, to quickly find typos and slips.

The “Title for The Script” field

on init
make_perfview
end on

The Text you put into the “Title for the Script” field is also visible on the respective UI tab outside the edit mode (wrench button). But only when using multiple tabs in combination with the “make_perfview” command (see the image above).

The “make_perfview” command just makes the actual script tab visible outside the edit mode. You need it whenever you make a custom UI with knobs, buttons etc (of which more in later tutorials).

Try it yourself by putting the upper code into 2 or more tabs and enter some text into the “Title for the Script” field

“External” Editors

For code writing you should rather use an “external” or 3rd party editor which makes coding much easier like colorizing your code, working with indents and offering great additional features like syntax checks, macros etc. Sublime Text is the tool to go here. For further info read our Setting up Sublime 3 Tutorial.

But of course you can also use any other text editor which already simplifies a lot because of the much bigger working space .. scrolling sucks ;)

How useful was this article?

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

NOTE: highly negative votes may be removed without any reasonable given feedback!

Jean-Nicolas Verreault

basically it's like an advanced text editor but with a lot of helpful extra features (like coloring your code) which makes coding a lot easier.
Especially with sublime text you get tons of intelligent ksp features like macros or functions where you can pass parameters. You can get sublime text at https://www.sublimetext.com/

Please subscribe to our newsletter

please subscribe for our newsletter. We put lots of work into our free products and we would really appreciate it if you keep your subscription. But you can unsubscribe again at any time in your account under MyProfile or within the newsletter itselfMore info

We only send out a few newsletters a year about special deals or discounts and other product updates and useful info