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 Text 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 😉
Jean-Nicolas Verreault
What is an external editor? Can someone answer me?YummyBeats
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/