# KONTAKT ksp SCRIPT to use Keyswitch into CC#



## jorgevb2000 (Mar 3, 2020)

Hi everyone, I'm new in here... I've been trying to write an script in order to use Keyswitches from my library to release or trigger the legato function wich is attached to CC#20. I don't use any midi device (keyboards or pads) so is very important for me to have this as a keyswitch. I've tried something with no results:

on note
if ($EVENT_NOTE=$KeySwitch)
ignore_event($EVENT_ID)
$toggle := 1 - $toggle
set_engine_par($ENGINE_PAR_EFFECT_BYPASS,$toggle,-1,0,1)
end if
end on

on midi_in
if ($MIDI_COMMAND = $KeySwitch)
set_midi($CC_NUMBER, $MIDI_BYTE_1)
end if
end on

on release
if ($EVENT_NOTE=$KeySwitch)
ignore_event($EVENT_ID) 
set_engine_par($ENGINE_PAR_EFFECT_BYPASS,0,-1,0,1)
end if
end on


But the Kontakt says the lane { set_midi($CC_NUMBER, $MIDI_BYTE_1) } is wrong... I'm not a programmer so maybe some of you may guide me in this thread.

Thank you very much!!


----------

