# KScript Editor V1.5.1



## kotori (Feb 25, 2012)

Hi everone,

I have now released the 1.5.1 version of KScript Editor. :arrow: *Download link*

Changes:
Added integration with Task Control Module (see TCM guide)
Made it possible to pass function names as parameters
In optimization mode all unused functions are now removed
If the first parameter to get_control_par or set_control_par
is a UI variable it will automatically be wrapped with get_ui_id(...).
Added new property feature
Added new control parameter access feature (see the example shown upon installation)
Added possibility to override functions 
Added auto completion after "->" characters
Hex numbers ending with a capital H are now recognized too
When reopened the program remembers whether it was maximized
New web based import added: import "http://<<myurl>>"
A big thanks to Big Bob for all the hard work on the Task Control Module and its documentation - please study the TCM guide. I have also updated my overview of the syntax extensions in KScript Editor a bit to reflect most of the updates.

Cheers,
Nils


----------



## mk282 (Feb 26, 2012)

Thank you for this, Nils! Donated! 

I must say that the new property feature, along with control parameter access is making scripting A WHOLE LOT FASTER for me. Especially when dealing with modulators (courtesy of the property feature along with an include module), there are no more code sausages!


Let's compare this:


```
on ui_control (LFOAmt)
    set_engine_par(ENGINE_PAR_INTMOD_INTENSITY, LFOAmt, 1, find_mod(1, "LFO"), find_target(1, find_mod(1, "LFO"), "LFO -> CUTOFF"))
    set_control_par(get_ui_id(LFOAmt), CONTROL_PAR_LABEL, get_engine_par_disp(ENGINE_PAR_INTMOD_INTENSITY, 1, find_mod(1, "LFO"), find_target(1, find_mod(1, "LFO"), "LFO -> CUTOFF")) & " Hz")
end on
```

to this:


```
on ui_control (LFOAmt)
    group[1].mods["LFO"].target["LFO -> CUTOFF"].mod_amt := LFOAmt
    LFOAmt -> label := group[1].mods["LFO"].target["LFO -> CUTOFF"].mod_amt.disp
end on
```


Say hello to a lot more readable and *sensible* code (something NI forgot along the way...), and don't stop thanking Nils, because it's never enough!


----------



## kotori (Feb 26, 2012)

Hi mk282,

thanks a lot :D 
Btw. I think you do a nice job showcasing the fact that it is also possible to use a string as property index. The syntax highlighted source code of the module that you use can be found http://nilsliberg.se/ksp/scripts/engine_parameters.html (here). Thanks to the new possibility to import script modules from the web anyone can easily try this out by using a script such as this:

``*import* "http://nilsliberg.se/ksp/scripts/engine_parameters.ksp"````_{ <-- fetches the module from the given URL }_

``*on init*
````_{ effect parameters }_
````insert[0].eq_gain1 := 100000 _{ set EQ gain (first insert effect) }_
````send[1].rev_size := 700000```_{ set reverb size (second send effect) }_
````group[0].slot[1].rev_size := 700000```_{ same thing but for a group effect }_
````````
````_{ modulators }_
````*declare* ui_knob LFOAmt(0, 100, 1)``
````group[1].mods["LFO"].target["LFO -> CUTOFF"].mod_amt := LFOAmt
````LFOAmt->label := group[1].mods["LFO"].target["LFO -> CUTOFF"].mod_amt.disp`````
``*end on*

Cheers,
Nils


----------



## tonewill (Feb 26, 2012)

Yes, thanks a lot Nils. The new syntax makes things a lot nicer to write and read. I haven't tried the other new features yet.


----------



## MaestroRage (Feb 26, 2012)

I don't see why NI doesn't bundle this incredible tool with Kontakt. Probably quite ignorant to say as there must be a thousand layers of red tape to go through first.


----------



## moonstruck180 (Feb 26, 2012)

Thanks! I love this software!

One thing I did notice however...

When you copy and paste script from kontakt 4 to KScript Editor it looks fine, but when you save it as a text then import it say back into kontakt after the save because you wanted it in your resource container, the code only shows up on one line.

To fix that you have to copy and paste the code, compile it in the editor REcopy and paste in a new file then overwrite the existing file before adding the code to the container. Is there maybe a shorter way to do this? lol

Thanks again!


----------



## kotori (Feb 26, 2012)

moonstruck180,
I'll try to have a look when I find the time. Have you tried to use #pragma save_compiled_source?


----------



## masonroza (Feb 27, 2012)

The one line thing is present for a long time in OS X. It pretty much forces me to only use PC for scripting because the pragma as well as the saving to text creates the one line long file(HTML export too but I rarely use that). I believe it has something to do with line endings (LF versus CR that KSE Mac is using and it shouldn't)

Also on the Mac, pasting a long(ish) script (2000+ lines) causes an endless beachball...

I have read about this problem before and KSE is awesome on the PC but quite unusable on the MAC as of now(in my experience at least).


----------



## dxmachina (Feb 27, 2012)

Hey Nils... Wow, a seriously brilliant update. 

Having a couple issues on Mac which aren't present with 1.5.0:

1. Application no longer quits with keyboard shortcut or dropdown menu

2. Autocomplete seems to be broken

3. Syntax highlighting seems to exhibit unexpected behavior

Reverting to 1.5.0 for now.


----------

