# Nils' Kontakt Script Editor Sublime 3 Plugin Download Link



## d.healey (Mar 20, 2014)

I posted this in another thread but as suggested there I'm posting it here too so that it's easy to find 



> Hello guys,
> 
> I've just spoken with Nils and he's happy for me to share the Sublime 3 plugin with you. I've put it in my dropbox.
> 
> ...



Update:
Hi Guys, I noticed Nils has put a link up on his site now so I'll be taking my dropbox link down shortly.


----------



## BrandonSpendlove (Mar 21, 2014)

Thanks a ton! It's so brilliant what he does to make it quite a bit less of a pain to script Kontakt instruments.


----------



## TGV (Mar 21, 2014)

I can't seem to get this to work on my mac. While ksp files do get syntax coloring, the KSP menu items under Tools are all greyed out. Does anyone know why that is?


----------



## d.healey (May 8, 2014)

Hi TGV, I only just came back to this thread and saw your comment! Did you manage to get it working?


----------



## TronicLabs (May 16, 2014)

Hi, I'm not a very good programmer in Python, and I was wondering how to add to compiler a command to the macro, its function should serve as an IF ELSE, but only to decide which piece of code to have in code with a boolean variable. 
example:


```
{ MACRO }
macro make_slider( #var#, #min#, #max#,#boolean#)

    declare ui_slider #var#(#min#, #max#)
      { what I would like to integrate in the compiler}
    _IF(#boolean#)  
      { if TRUE add this line to Macro otherwise not }
      make_persistent(#var#)
      _read_persistent_var (#var#)

    _ELSE

      {in this case do not add this line}

    _END IF

end macro

on init
    make_slider(mySlider, 0, 127, 1)
end on
```

thanks for every address in this direction


----------



## d.healey (May 17, 2014)

I have no experience with this in Kontakt, is this in the documentation?


----------



## TGV (May 17, 2014)

TotalComposure @ Thu May 08 said:


> Hi TGV, I only just came back to this thread and saw your comment! Did you manage to get it working?


Yes. In another thread someone answered that it did work in his mac, and so I just deinstalled and reinstalled, and then it magically worked. It's a nice thing. I have been thinking to hook it up to Emacs (my preferred editor), but that's another story.

Thanks for asking, and I'm late too: for some weird reason I didn't get a message about your reply.


----------



## d.healey (May 17, 2014)

I'm glad you got it working


----------



## TronicLabs (May 17, 2014)

TotalComposure @ Sat May 17 said:


> I have no experience with this in Kontakt, is this in the documentation?



in kontakt it already exists, you can use the command 

SET_CONDITION (<condition>) 
USE_CODE_IF (<condition>) 
END_USE_CODE 
RESET_CONDITION (<condition>) 

when used with conditions that do not begin with NO_SYS they will not be visible in the compiled code, can be used when creating external library, such as a utility for the compiler to determine if the code will be used or discarded. But it does not seem to work in macros since the function is declared in python before the extraction and expansion of the macro. 

in my case, the new function it should have a simple IF / ELSE that would not be written in the code, but only used by the compiler to decide on the basis of a condition, declared in a #var# in a macro, if you include that part of the code.


----------



## TGV (May 18, 2014)

I've just been looking at the Python code of Nils' plugin, and I see two things:
1. it shouldn't be too hard to implement a macro if/then/endif for someone with a bit of time.
2. The code feels buggy. It doesn't seem to distinguish between a real END_USE_CODE and one in a comment or in a string. It also seems to do something based on the presence of the string "on_init" in function names...


----------



## TronicLabs (May 18, 2014)

OK
I have succesfull implemented this function in the compiler and plugins code.
Now, how I can share with you regard Nils Liberg licence and the author of plugin?
Can i can make a GITHUB repository?


----------



## gh (May 18, 2014)

Hi!

There is actually no need to change the compiler for this.

*on init*
````declare_slider(test,1,100,1)
*end* on

*macro* declare_slider(#var#,min,max,persist)
````*declare* ui_slider #var# (min,max)
````*if*(persist # 0)
````````make_persistent(#var#)
````````read_persistent_var(#var#)
````*end* *if*
*end* *macro*


This will exactly do what you want.

Cheers
gh


----------



## TronicLabs (May 18, 2014)

gh @ Sun May 18 said:


> Hi!
> 
> There is actually no need to change the compiler for this.



this not hide the piece of code to compiled code but only add the condition in the final code.


----------



## showard (May 20, 2014)

I installed Sublime 3. Now ... how do I use this Sublime KSP item??
Is there a simple answer? Or can someone point me to the relevant documentation?
Thanks.


----------



## d.healey (May 21, 2014)

There is a read me file in the archive, just open it in a text editor and it has all the installation instructions to get you up and running.


----------



## gh (May 21, 2014)

Troniclabs:

Turn "KSP: Optimize compiled code" on

and change the declaration to:

declare_slider(test,1,100,0)

This will compile to:

on init
declare ui_slider $test(1, 100) 
end on


----------



## TronicLabs (May 22, 2014)

@gh
hehe, it's true,
i always have the code optimization in off mode, to make direct modification in the kontakt editor.

With my mod i can write conditional piece of code, also with optimization code off,
this appear more suitable for library creation.

anyway thanks for the valuable info.


----------



## d.healey (Sep 13, 2014)

Hello,

I've made a little video showing how to install Sublime Text 3 and the KSP plugin. 
Enjoy!


----------



## geronimo (Sep 20, 2014)

Please, where do we put the KSP Sublime folder on an Apple computer ?


----------



## d.healey (Sep 20, 2014)

I don't have a Mac but I would assume that you follow the same procedure I show in the video. Go to the preferences menu and select browse packages and that will show you the location to unzip the SublimeKSP folder to.

Report back and let me (and anyone else browsing the thread) know if it worked


----------



## geronimo (Sep 20, 2014)

Yes, you can see them from the Tools menu but they are inaccessible !


----------



## d.healey (Sep 20, 2014)

Make a new file and save it with the .ksp extension.


----------



## geronimo (Sep 20, 2014)

No, no improvement; perhaps it comes from there it is a UNREGISRED release.
I have not yet purchased the license.


----------



## d.healey (Sep 20, 2014)

You don't need the license for it to work. Press cmd+P and type KSP then hit enter.


----------



## geronimo (Sep 20, 2014)

The problem is that I write fairly simple scripts for Kontakt: I am a beginner but does not include the use of these tools ? Write a script faster ?
For my part, I learned memory codes and writes directly in Script page KONTAKT; it may be longer and small to read, view the text . :oops:


----------



## d.healey (Sep 20, 2014)

The size of your scripts doesn't make a difference, the Sublime KSP will work with them. I'm not sure why it's not working for you, maybe someone else here who has it working on a Mac could chip in and help you out?


----------



## geronimo (Sep 20, 2014)

It's not easy, digital but for me, I already provide a Mac shortcut in comments  on Youtube for your tutorial.
So I helped a little but is rarely return. Maybe it does not work with Apple machines.

Knowing the logic of these machines, the relevant files are kept in the "Download" so it's normal that Sublime Text Application does not detect them. I need to find the file for Sublime Text Preference finally her .


----------



## Gslap (Jan 15, 2015)

Hi,

is the KSscript editor 1.5.2 available for Kontakt 5 ?

Or have I to use the new sublimeText pluggin ? (that annoyed me a little cause I don't like sublimeText...)

G


----------



## mk282 (Jan 15, 2015)

Sublime is excellent and in every way better than KScript editor.


----------



## d.healey (Jan 15, 2015)

The editor isn't tied to a particular version of Kontakt so you can use it if you like, but the sublime text editor will make your life easier


----------



## gregjazz (Jan 15, 2015)

mk282 @ Thu Jan 15 said:


> Sublime is excellent and in every way better than KScript editor.


This. I can't go back to KScript now that you got me using Sublime.


----------



## mk282 (Jan 15, 2015)

TotalComposure @ 15.1.2015 said:


> The editor isn't tied to a particular version of Kontakt



It actually is if it's not updated with the new commands introduced since Kontakt 5.0.0., and KSE is missing those from 5.2.1 onward, IIRC.


----------



## Robym (Jan 18, 2015)

Sorry in case somewhere someone have already mentioned this but,

is there an updated version of KSP plugin for Sublime Text with the new commands of K5.4.2?
(snapshots etc...)

and if yes, how is the upgrade procedure if i already have an earlier KSP plugin installed? do i have to replace the old one or just add the new one? or else?

thank you

R.


----------



## Gslap (Jan 23, 2015)

Thank you for your answers, I finally switch to sublim.


----------



## Dynamitec (Jan 24, 2015)

Robym @ Sun Jan 18 said:


> Sorry in case somewhere someone have already mentioned this but,
> 
> is there an updated version of KSP plugin for Sublime Text with the new commands of K5.4.2?
> (snapshots etc...)
> ...



Yes! The updated sublime plugin can be downloaded from Nil's page now: http://www.nilsliberg.se/ksp/


----------



## mk282 (Jan 25, 2015)

Just checking that v1.1 of SublimeKSP plugin, it's missing commands and constants for dealing with MIDI object and new key colors that were implemented in K5.4.1. Some parts in syntax coloring (.tmLanguage file), some parts in ksp_builtins_data.py. Will notify Nils about it.


----------



## Tod (Jan 29, 2015)

Are there any tutorials or instructions showing how to get all the benefits associated with SublimeKSPv1.1?

I think I've got it installed properly, I can load scripts.

I kind of miss the navigation window on the left but that window on the right works pretty well for getting around. 

I've done a lot of experimenting along with some searching but haven't been able to find how things actually work. :?


----------



## d.healey (Jan 30, 2015)

Have a read of the documentation on the sublime text website, lots of good info there. Press Ctrl+R to get the functionality of the left hand side bar you're missing, it takes some getting used to. As far as KSP specific things the main benefits are the same as the old kseditor just improved, for instance auto completion, and fuzzy searching for commands and constants etc.


----------



## Tod (Jan 30, 2015)

TotalComposure @ Fri Jan 30 said:


> Have a read of the documentation on the sublime text website, lots of good info there. Press Ctrl+R to get the functionality of the left hand side bar you're missing, it takes some getting used to. As far as KSP specific things the main benefits are the same as the old kseditor just improved, for instance auto completion, and fuzzy searching for commands and constants etc.



Thanks David, I guess your talking about the Sublime Text 3 Documentation. I had a look at that the other day when I clicked on Help, but wasn't sure what to look for that equated to the KSP editor.

May I be so dense as to ask, what is fuzzy searching? :?


----------



## mk282 (Jan 30, 2015)

Fuzzy means that you can search stuff by non-sequential letter entry. So, to find "salt", you don't need to start typing "sa", you can do it with "st" as well.

Makes finding longer commands and variables a lot faster indeed. Since you can get things like, say, cur_listener_id by simply typing "cli".


----------



## Tod (Jan 30, 2015)

mk282 @ Fri Jan 30 said:


> Fuzzy means that you can search stuff by non-sequential letter entry. So, to find "salt", you don't need to start typing "sa", you can do it with "st" as well.
> 
> Makes finding longer commands and variables a lot faster indeed. Since you can get things like, say, cur_listener_id by simply typing "cli".



Aah, okay, I actually tried that but wasn't getting the results I saw in David's video so I thought there was another way. However, I was typing the commands in straight away, so thanks for the great tip mk282, now I understand. o-[][]-o


----------

