# Help with Kontakt script [SOLVED]



## Claud9 (Nov 3, 2016)

Hello everybody,
I have successfully created a knob to control the send level of a convolution reverb.
Is it possible with a script to tell Kontakt to bypass the convolution reverb when the send knob is in the zero position (-inf dB) and to activate it when the send knob is activated and has a value greater than zero?
So basically : 
Knob set to zero : Bypass On
Knob set to > Zero : Bypass Off
I suppose that with the "if/end if" could be possible but my scripting skills are very limited...
Thanks in advance for any help!


----------



## d.healey (Nov 3, 2016)

yes. You just need an if statement that says

```
if knob = 0 set_engine_par(ENGINE_PAR_SEND_EFFECT_BYPASS...., 1) else set_engine_par(ENGINE_PAR_SEND_EFFECT_BYPASS...., 0)
```
 this is just pseudo code so you'll need to fill in the blanks but all you need is an if statement with the set_engine_par() command and the send effect bypass constant - it's all in the manual


----------



## Claud9 (Nov 3, 2016)

d.healey said:


> yes. You just need an if statement that says
> 
> ```
> if knob = 0 set_engine_par(ENGINE_PAR_SEND_EFFECT_BYPASS...., 1) else set_engine_par(ENGINE_PAR_SEND_EFFECT_BYPASS...., 0)
> ...


Thanks I tried this but I got this error : "Expression expected"

if ($send1 = 0) set_engine_par(ENGINE_PAR_SEND_EFFECT_BYPASS,-1,2,0,1) 
else 
set_engine_par(ENGINE_PAR_SEND_EFFECT_BYPASS,-1,2,0, 0) 
end if


----------



## d.healey (Nov 3, 2016)

You need to put the command on a separate line, below the

```
if ()
```
 Also your parameter values aren't correct.


----------



## Claud9 (Nov 3, 2016)

d.healey said:


> You need to put the command on a separate line, below the
> 
> ```
> if ()
> ...


Thanks.
I tried to understand how it works from your suggestions and the manual and I have this :

if ($send1 = 0) 
set_engine_par($ENGINE_PAR_SEND_EFFECT_BYPASS,1,-1,2,0)
else 
set_engine_par($ENGINE_PAR_SEND_EFFECT_BYPASS,0,-1,2,0) 
end if

For Kontakt is ok "no error" but It does not work, the Convolution Rev is not bypassed when the knob value is set to 0..
What is wrong?
Thanks in advance for any help


----------



## geronimo (Nov 4, 2016)

Are you writing this code in the second part of your KSP text (on ui_control ($send1) ?


----------



## polypx (Nov 4, 2016)

Be sure your "2" is correct as well, the slot positions are "zero based", so "2" refers to the third slot.


----------



## Claud9 (Nov 4, 2016)

Now it works! Thanks to all for the help!

This is the final working script just in case somebody will need it!

on ui_control ($send1)
if ($send1 = 0) 
set_engine_par($ENGINE_PAR_SEND_EFFECT_BYPASS,1,-1,2,0)
else 
set_engine_par($ENGINE_PAR_SEND_EFFECT_BYPASS,0,-1,2,0) 
end if


----------

