# Scripting knob image help



## Alan Wave (Jul 24, 2015)

Hello
I am new to scripting and i need a little push.
I try to give my knobs their own image.
I've followed a tutorial of a pitch knob and i made it. In the scripting it was set as a slider:

declare ui_slider $custom_pitch(-100, 100)
hide_part($custom_pitch, $HIDE_PART_BG .or. $HIDE_PART_MOD_LIGHT .or. "knob1")
set_control_par_str(get_ui_id($custom_pitch), $CONTROL_PAR_PICTURE, "knob1")
etc..

I learned from the manual how to create knobs and i made a cutoff
declare ui_knob $myCutoff
etc..
when i write the script to import the knob file it doesn't show up:
set_control_par_str(get_ui_id($myCutoff), $CONTROL_PAR_PICTURE, "knob1")

I created from the beggining a resource folder from Kontakt and put the knob image there. I use Kontakt 5 on Windows.

Am i forgetting something?


----------



## d.healey (Jul 24, 2015)

Have you created a resource container, through the instrument options window? Also you'll probably want to change the range of your slider to 0 - 1000000.


----------



## Andrew Goodwin (Jul 24, 2015)

Did you make sure to include a .txt file with the same name as the image for the knob? If it's the same example I worked with a while back you can simply copy that .txt file, change the file name and place it in the folder with the image.


----------



## Alan Wave (Jul 24, 2015)

d.healey said:


> Have you created a resource container, through the instrument options window? Also you'll probably want to change the range of your slider to 0 - 1000000.



Hi, thanks for the reply. Yes the resource was created properly inside Kontakt with nkr, pictures folder, data folder etc. I don't need the slider anymore since it was for my education at scrpiting.
I now want to create knobs assigning to the effects i want (such as Cutoff) with my own image for knob.
It is working but the knob image doesn't show up.
the script:

on init
make_perfview
set_ui_height_px(400)

declare ui_knob $myCutoff (0,1000000,1)
move_control_px ($myCutoff,24,80)
set_text ($myCutoff, "Cutoff")
set_control_par_str(get_ui_id($myCutoff), $CONTROL_PAR_PICTURE, "knob1")
make_persistent($myCutoff)
set_knob_unit($myCutoff,$KNOB_UNIT_HZ)

end on

on ui_control($myCutoff)

set_engine_par($ENGINE_PAR_CUTOFF,$myCutoff, 0, 0,-1)
set_knob_label($myCutoff,get_engine_par_disp($ENGINE_PAR_CUTOFF, 0, 0,-1))

end on


----------



## FrozenPlain (Jul 24, 2015)

Knobs cannot have custom graphics, you will need to change $myCutoff into a ui_slider. To make the slider react vertically to the mouse you can use CONTROL_PAR_MOUSE_BEHAVIOUR and give it a negative value, -500 is a good starting point.


----------

