1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

How To Load Scripts

Discussion in 'Scripting Workshop' started by jimlau, May 25, 2012.

  1. jimlau

    jimlau NI Product Owner

    Messages:
    29
    i have a script, in the form of a text file and an nkp file. what do i need to do and where do i put files for kontakt to load them, for kontakt 4 or 5?

    thanks.

    total newbie.
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You can load the text file directly. Open it in Notepad, select the whole document, then copy it. Open your instrument in Kontakt, go into Edit mode (monkey wrench button), go to Script Editor, pick a slot, click on "Edit", paste the code, press Apply.


    PC or Mac?
     
  3. jimlau

    jimlau NI Product Owner

    Messages:
    29
    got it - thanks! i do notice on some instruments it seems all 5 slots are already being used. is there a way to add a 6th?

    PC by the way.
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    No, you cannot add a 6th slot. 5 is all there is.


    For PC, put your NKP scripts to:

    C:\Documents And Settings\<your username>\My Documents\Native Instruments\Kontakt 4\Presets\Scripts

    on Windows XP. For Windows 7, it's similar, except instead "Documents And Settings" you use "Users" folder.

    And for Kontakt 5, you go to Kontakt 5 folder. :)
     
  5. daslicht

    daslicht NI Product Owner

    Messages:
    396
    How about this location?
    [​IMG]
     
  6. discode

    discode New Member

    Messages:
    9
    You can use the apply from location but I believe that it would require him to use a .nkr file. In instrument options you would need to create a kontak resource file and create the directory structure for one on the hard drive. Then just copy your scrip into resources-->scripts location that was created when making the .nkr file.

    Then you should be able to go back to the scrip editor and under apply from-->resource folder-->scripts and choose your new script file.
     
  7. daslicht

    daslicht NI Product Owner

    Messages:
    396
    Apply from should be able to point to a ksp file, no? Other case it would be hard to code in an external editor...?
    Autorefresh on file save would be lovely (as it is possible with web stuff these days)
     
  8. discode

    discode New Member

    Messages:
    9
    That may well be possible with EvilDragons explanation and a ksp file. To be honest I have not tried it that way. If I am not mistaken EvilDragon suggested that jimlau copy his .ksp (or .txt) file to the user directory. So in the image that you posted jimlau may have a user menu populated with the script.

    What I suggest above will also work.....with external code editing. I use Sublime text with the Kontakt scripting extension and develop scripts this way.

    Basically you would be using .txt files (most likely .nkp will work too) for the script files (which the OP had mentioned having) and using instrument options to create a .nkr as well as to create a resources directory structure that you would place your scripts/images/impulses/etc in and package up all of the bitmap resources along with the scripts and everything else.

    To perhaps give a bit of perspective, Im on a Mac and have only really ever created a .nkr file to save out all of the UI and script stuff to obfuscate it from the user on the other end of the distributed files. So I probably totally missed the point of the OP's question. ;-)
     
    Last edited: Mar 17, 2015
  9. daslicht

    daslicht NI Product Owner

    Messages:
    396
    If i put a nkp file here:
    C:\Users\<username>\Documents\Native Instruments\Kontakt 5\presets\Scripts
    It shows up here in kontakt:
    [​IMG]

    But how to make it show up here, where is that location on Windows ?, please:
    [​IMG]
     
  10. discode

    discode New Member

    Messages:
    9
    I can only speak to the way that I use this stuff. I am currently at work so this will strictly be from memory so I apologize in advance if I miss something. In a nutshell here is what I do when using an external script editor and developing Kontakt scripts.

    Steps for starting from scratch:
    1) Launch Kontakt and click wrench button
    2) Go to instrument options and make sure to click on the instrument tab
    3) At the bottom of the UI there is a Resource Container label with an edit box and a couple of buttons at the right
    4) You want to click on the create button next to the resource container edit box
    5) It should ask you where you would like to create your resource directory on your hard-drive so just browse to any location that will work for you and then click yes to create the folder
    6) Outside of Kontakt if you browse to the location that you just created the resource directory you will notice it has made 4 folders. One of these folders is a scripts folder. This is where you want to place your script files as you develop them. So you may want to copy a script file over now but it isnt required.
    7) You should notice in the Resources Container field (in instrument options) that it is referencing the directory that you just created and it should say something like (reading from resource folder) after the directory name.
    8) Close out of instrument options and then open the script editor
    9) Now under the Apply From drop list in the script editor you should see an entry for resources-->scripts--> then whatever script files you have copied into the scripts folder should be visible now.
    10) At this point you should be good to go. You can make any changes you like to the scripts in the resource folder and hit the apply in the scrip editor to see it (meaning the Kontakt UI) update.

    This is just my way of working.... There may be other ways to achieve what you are after.
     
  11. daslicht

    daslicht NI Product Owner

    Messages:
    396
    Thank you very much ! that works perfectly !
     
    Last edited: Mar 25, 2015
  12. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You need to use () in KSP.
     
    • Like Like x 1
  13. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    if ($EVENT_NOTE = 61 and $EVENT_NOTE = 62)


    However, for what you want to do, this is a better way:


    if (%KEY_DOWN[61] and %KEY_DOWN[62])
    play_note(70,$EVENT_VELOCITY,0,-1)
    end if
     
    Last edited: May 2, 2017
    • Like Like x 1
  14. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    OK first:

    * please write in English
    * ESPECIALLY write the code in English!


    Otherwise, I have already replied to what you want to do. Use %KEY_DOWN[] instead of $EVENT_NOTE for the "if" clause.
     
  15. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    I already wrote you the code above. Please read back.

    Note how () is used here.
     
  16. cnkrc

    cnkrc New Member

    Messages:
    11
    Hello,

    I have a question within same category, so I decide to write a new message on the same topic.

    Sometimes, I noticed that some instruments are coming with own scripts. If all 5 slots are used and not empty, how can we use our own script (.nkp) file? I added my tuning script to Kontakt location and I can see it in the presets area, is there a way to replace/activate it?

    Thanks in advance.
     
  17. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    There are only 5 script slots, so if all 5 are taken, there's probably a good reason why it's like that, so it is not a good idea to replace any of those scripts, at all.

    But otherwise, you'd just load your preset over any of those scripts. Prepare for disaster though, because the instrument in question might start behaving differently if any of those 5 already loaded scripts were doing something important!
     
  18. cnkrc

    cnkrc New Member

    Messages:
    11
    Thank you so much EvilDragon, If I load my preset to used slot, it will replace it or add below/above it?

    Thanks again.
     
  19. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    It will replace it. There's no facility to add script slots :)