What's new

Why store scripts in the resource folder/container ?

Fredeke

Active Member
I wonder: why is there a script folder in the resource container?
Aren't my scripts already saved in their respective slot within the nki?

And, if the script folder is just there for my developer's convenience, then I suppose I can save uncompiled SublimeKSP scripts there?
 

d.healey

Music Monkey
If you edit directly in Kontakt's (horrible) script editor then your script is saved in the NKI. If you choose to link your script to a file in resources folder then your script needs to be in the resources folder. If you want to use a resource container then your script also needs to be in the resources folder.
 
OP
Fredeke

Fredeke

Active Member
I get what you're saying, but it doesn't fit my empiric experience.

I am scripting in SublimeKSP, which precompiles scripts and places them in the clipboard for pasting into Kontakt's (horrible) script editor.

I am using a resource folder for pictures, but Kontakt doesn't seem to read the scripts from there (it wouldn't understand them anyway, since they're not precompiled). Instead it executes what is in the nki's script slots. Will that change when I finalize the instrument, and the folder gets replaced by the nkr file?

Also, if I really have to place my scripts in the resource folder, then how do I link them to specific slots ? They need to be executed in a specific order.

I hope I'm expressing myself clearly. It's easy to get confuse(d)...
 
Last edited:

d.healey

Music Monkey
I am scripting in SublimeKSP, which precompiles scripts and places them in the clipboard for pasting into Kontakt's (horrible) script editor.
This is a slow method. If you use the resources folder and a pragma command in Sublime you can get it to compile the script and save it to a text file in the scripts folder. Then you don't have to bother pasting into Kontakt you just need to click the ! to reload the script.

https://nilsliberg.se/ksp/scripts/tutorial/editor.html#pragma

Also, if I really have to place my scripts in the resource folder,
You don't "have" to. But for me it made life easier.

then how do I link them to specific slots ?
Just select it from the drop down in the script editor.

upload_2019-7-1_15-6-27.png
 

kb123

Active Member
it becomes particularly useful to use the resources folder rather than the instrument directly when many instruments use the same script and you want to do an update. All you do then is replace the nkr rather than apply the script to each affected instrument.
 
OP
Fredeke

Fredeke

Active Member
it becomes particularly useful to use the resources folder rather than the instrument directly when many instruments use the same script and you want to do an update. All you do then is replace the nkr rather than apply the script to each affected instrument.
That's exactly what I want to do.
How do you do that btw? (not about the script - the whole shared nkr)
 

EvilDragon

KSP Wizard
You just link to the same NKR file from Instrument Options. Instead of clicking "Create", click the little folder button:

upload_2019-7-3_9-4-6.png
 

EvgenyEmelyanov

Composer | Programmer
I heard a couple of times it's better to have the scripts inside the instrument instead of Resources folder. For instance, because somebody easily can encode the library and see txt files and pictures. What do you think?
 

neblix

Music, Math, Cats
There's a very important thing to remember about the resource container.

The NKR does not update automatically even as you are updating files inside the Resources/ folder it is based on. Kontakt will always go straight to the Resources/ folder if it is present for all of its scripts, pictures, arrays, etc. So while it appears your library is keeping up with your changes, the NKR file itself is actually dormant, unused and unchanged during the development process.

This means if you try to package up your product and release it without the Resources/ folder and distribute it with just the NKR, you will notice that the state of all pictures and scripts is basically travelling back in time to the moment you created the NKR. You should always "remake" the NKR every time you plan to distribute a library without the Resources/ folder.

This is done by simply opening a blank NKI, navigating to the Instrument Options, and hit "Create" at the resource container part. Go to the same folder and just name the new container the same as the old one, overwrite. The NKR will then be recreated with all the current data in the Resources/ folder and you can now distribute the library without the Resources/ folder.
 
Top Bottom