# Newie question - get_ui_id() and $CONTROL_PAR_PICTURE / TEXT



## otto_von_borst (Feb 16, 2013)

why there are no of my png-animations displayed, although there are
in the resource container folder of my project?

would "set_control_arr" an approach? 


on init

declare ui_slider $Knob_1 (0,100000)
declare ui_slider $Knob_2 (0,100000)
declare ui_slider $Knob_3 (0,100000)
declare ui_slider $Knob_4 (0,100000)

declare %slider_id[4]
%slider_id[0] := get_ui_id ($Knob_1)
%slider_id[1] := get_ui_id ($Knob_2)
%slider_id[2] := get_ui_id ($Knob_3)
%slider_id[3] := get_ui_id ($Knob_4)


set_control_par_str(get_ui_id(%slider_id),$CONTROL_PAR_TEXT,"test_knob")
set_control_par_str(get_ui_id(%slider_id),$CONTROL_PAR_PICTURE,"test_knob")
set_control_par(get_ui_id(%slider_id), $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
end on


thanks for a thoughtless abutting


----------



## Big Bob (Feb 16, 2013)

Probably isn't anything this easy but, is your test instrument pointed to your .nkr file?

ie have you filled in the Resource container field in Instrument Options?

If you haven't done that, Kontakt will not look for the pixes in your resource folder.

Rejoice,

Bob


----------



## Big Bob (Feb 16, 2013)

Whoops! I just saw what may be your problem.

set_control_par_str(get_ui_id(%slider_id),$CONTROL_PAR_PICTURE,"test_knob")

You don't want to get the id of the id array. Shouldn't this be:

set_control_par_str(%slider_id[0]),$CONTROL_PAR_PICTURE,"test_knob")
as an example?

Rejoice,

Bob


----------



## otto_von_borst (Feb 16, 2013)

Yep, i filled in the Resource container field in Instrument Options. 

this variant works: (in the same project)

on init
make_perfview
set_ui_height(6)
declare ui_slider $Filter (0,1000000)

set_control_par_str(get_ui_id($Filter),$CONTROL_PAR_TEXT,"test_knob_new")
set_control_par_str(get_ui_id($Filter),$CONTROL_PAR_PICTURE,"test_knob_new")
set_control_par(get_ui_id($Filter), $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)

end on


----------



## otto_von_borst (Feb 16, 2013)

Yep, i filled in the Resource container field in Instrument Options. 

this variant works: (in the same project)

on init
make_perfview
set_ui_height(6)
declare ui_slider $Filter (0,1000000)

set_control_par_str(get_ui_id($Filter),$CONTROL_PAR_TEXT,"test_knob_new")
set_control_par_str(get_ui_id($Filter),$CONTROL_PAR_PICTURE,"test_knob_new")
set_control_par(get_ui_id($Filter), $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)

end on


----------



## Big Bob (Feb 16, 2013)

*Me thinks you must have missed my second post above? :lol: *

If you fill an array with the ui ids like you did, then just use the appropriate array element for the first parameter and don't wrap it in get_ui_id again like you did.

Rejoice,

Bob


----------



## otto_von_borst (Feb 16, 2013)

oops ya, of course i don´t want get the id of the id array for this.
but strage, set_control_par_str(%slider_id[0]),$CONTROL_PAR_PICTURE,"test_knob") 
also doesn´t work! hmmm..


----------



## Big Bob (Feb 16, 2013)

I notice that the example you say doesn't work and the one that does refer to different pixes. The one with %slider_id[0] uses "test_knob" but the one you say works uses "test_knob_new". Could that be your problem?

If not, maybe you could post your actual code that you are using for testing this? If it's lengthy, simplify it first so that it's only dealing with loading one pix and remove all the other stuff.

Rejoice,

Bob


----------



## otto_von_borst (Feb 16, 2013)

hey bob,

"test_knob_new" isn´t the problem, because i also have "test_knob" in the resource container (png & txt).
i guess i have to explain what i exactly want to do:

currently i use this code to make my customized controlknobs visible.

---

on init
make_perfview
set_ui_height(6)
declare ui_slider $Attack (0,700000)
declare ui_slider $Decay (0,1000000)
declare ui_slider $Release (0,1000000)

set_control_par_str(get_ui_id($Attack),$CONTROL_PAR_TEXT,"test_knob_new")
set_control_par_str(get_ui_id($Attack),$CONTROL_PAR_PICTURE,"test_knob_new")
set_control_par(get_ui_id($Attack), $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)

set_control_par_str(get_ui_id($Decay),$CONTROL_PAR_TEXT,"test_knob_new")
set_control_par_str(get_ui_id($Decay),$CONTROL_PAR_PICTURE,"test_knob_new")
set_control_par(get_ui_id($Decay), $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)

set_control_par_str(get_ui_id($Release),$CONTROL_PAR_TEXT,"test_knob_new")
set_control_par_str(get_ui_id($Release),$CONTROL_PAR_PICTURE,"test_knob_new")
set_control_par(get_ui_id($Release), $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)

end on

---

now i´m searching for a smarter representation. because i will put in more than 3 controls in my script.
and it certainly makes no sense to have such repetitions in the script, or?



grüß gott,
otto


----------



## Big Bob (Feb 16, 2013)

Hi Otto,

We have got to get on the same page here. :lol: 

What I want to see is a simple test script that contains this code that you say *doesn't* display the custom graphic "test_knob":

```
set_control_par_str(%slider_id[0]),$CONTROL_PAR_PICTURE,"test_knob") 

where %slider_id[0] := get_ui_id(name)
```

whereas when you explicitly write it as:

```
set_control_par_str(get_ui_id(name),$CONTROL_PAR_PICTURE,"test_knob")
```
 the custom graphic* does* display.

Rejoice,

Bob

BTW Please ignore any extraneous spaces that the forum sometimes decides to insert where you least want them. For example, in the two code fragments above when I preview them, "test_knob" sometimes shows as "tes t_knob" , etc.


----------



## otto_von_borst (Feb 17, 2013)

the script that contains the code that doesn't display the custom graphic "test_knob" 
is to find in my first post, see above. The script itself contains no errors.


----------



## polypx (Feb 17, 2013)

There are errors in your first script. You need to do something like this:


```
on init

declare ui_slider $Knob_1 (0,100000)
declare ui_slider $Knob_2 (0,100000)
declare ui_slider $Knob_3 (0,100000)
declare ui_slider $Knob_4 (0,100000)

declare %slider_id[4]
%slider_id[0] := get_ui_id ($Knob_1)
%slider_id[1] := get_ui_id ($Knob_2)
%slider_id[2] := get_ui_id ($Knob_3)
%slider_id[3] := get_ui_id ($Knob_4)

declare $count := 0
while ($count < 4)
set_control_par_str (%slider_id[$count], $CONTROL_PAR_PICTURE, "test_knob")
inc($count)
end while
end on
```


----------



## otto_von_borst (Feb 17, 2013)

aah - I forgot to put in "$count".
thanks for that! but now the sliders works horizontal ?! how comes that an how can i change it into vertical?! should i change something in the txt-file?! Horizontal Animation: no/yes


----------



## Big Bob (Feb 17, 2013)

Set mouse behavior to some suitable negative value.

Think man, think :lol: 

Bob


----------

