EvilDragon
KSP Wizard
It is always a better idea to use picture state changing as much as possible rather than on the fly swapping the image. Just FYI.
It is always a better idea to use picture state changing as much as possible rather than on the fly swapping the image. Just FYI.
There's just an optional situation where the user could swap the menu's image (not the label) on the fly to accomodate a more graphically pleasing result. That's it...
Yes, that's what I was referring to. You can still do the same thing with picture state and a label.
I don't get why this is better than swapping whole picture files, but I find it actually convenient, so ok.
Just one thing (though this is probably just a detail) : what is the persistence_changed callback ? I couldn't find it in KSP5's reference. Is it KSP6 ? (I had to update my Kontakt version in order to run your example)
It's in the K5 reference manual, yes. It could be summarized as... an extension of the init portion of the script, or even a "kind of special function" that is automatically called upon after "on init".
Just one remark, in case you didn't realize : I had to update from Kontakt 5.2 to 6.0 in order to open your example. The only reason I can see for that is your use of the persistence_changed callback. Anyway, I'm glad I updated.
You needed the update! :D
You should check out other useful commands and controls that were added.
XY pad, increased width, etc. Too much stuff to remember...
I'm almost sure persistence changed arrived with the first release of K5...
But do you know which portion of the user base still uses older versions ?
Seems like they introduced it in version 5.7, or sometime between 5.2 and 5.7 anyway.
persistence_changed was added along with snapshots in Kontakt 5.4.
I read they added the $CONTROL_PAR_TEXTPOS_Y for value_edits, which is very welcome, so.. who knows?
Looks like at least in this sample of users, most are on latest versions. You don't have to worry about going too far back. Certainly not to K5.2 (or did you mean K5.5.2?).
on init
declare $mn_unison := 0
declare ui_button $mbt_unison
declare ui_button $mbt_unison_analog
declare ui_button $mbt_unison_digital
declare ui_button $mbt_unison_hybrid
declare ui_label $mlb_unison (1,1)
set_control_par_str (get_ui_id ($mbt_unison), $CONTROL_PAR_PICTURE, "mn-unison--")
set_control_par_str (get_ui_id ($mlb_unison), $CONTROL_PAR_PICTURE, "mn-unison")
set_control_par_str (get_ui_id ($mbt_unison), $CONTROL_PAR_TEXT, "")
set_control_par_str (get_ui_id ($mlb_unison), $CONTROL_PAR_TEXT, "")
set_control_par (get_ui_id ($mbt_unison), $CONTROL_PAR_POS_X, 388)
set_control_par (get_ui_id ($mbt_unison), $CONTROL_PAR_POS_Y, 72)
set_control_par (get_ui_id ($mlb_unison), $CONTROL_PAR_POS_X, 393)
set_control_par (get_ui_id ($mlb_unison), $CONTROL_PAR_POS_Y, 75)
set_control_par (get_ui_id ($mbt_unison), $CONTROL_PAR_WIDTH, 99)
set_control_par (get_ui_id ($mbt_unison), $CONTROL_PAR_HEIGHT, 14)
set_control_par (get_ui_id ($mlb_unison), $CONTROL_PAR_WIDTH, 91)
set_control_par (get_ui_id ($mlb_unison), $CONTROL_PAR_HEIGHT, 12)
set_control_par_str (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_PICTURE, "mn-unison--analog")
set_control_par_str (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_PICTURE, "mn-unison--digital")
set_control_par_str (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_PICTURE, "mn-unison--hybrid")
set_control_par_str (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_TEXT, "")
set_control_par_str (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_TEXT, "")
set_control_par_str (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_TEXT, "")
set_control_par (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_POS_X, 388)
set_control_par (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_POS_X, 388)
set_control_par (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_POS_X, 388)
set_control_par (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_POS_Y, 74)
set_control_par (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_POS_Y, 86)
set_control_par (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_POS_Y, 98)
set_control_par (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_WIDTH, 99)
set_control_par (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_HEIGHT, 16)
set_control_par (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_WIDTH, 99)
set_control_par (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_HEIGHT, 16)
set_control_par (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_WIDTH, 99)
set_control_par (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_HEIGHT, 16)
set_control_par (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
set_control_par (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
set_control_par (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
end on
function mn_unison
if ($mbt_unison = 1)
set_control_par (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_HIDE, $HIDE_PART_NOTHING)
set_control_par (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_HIDE, $HIDE_PART_NOTHING)
set_control_par (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_HIDE, $HIDE_PART_NOTHING)
else
set_control_par (get_ui_id ($mlb_unison), $CONTROL_PAR_PICTURE_STATE, $mn_unison)
set_control_par (get_ui_id ($mbt_unison_analog), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
set_control_par (get_ui_id ($mbt_unison_digital), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
set_control_par (get_ui_id ($mbt_unison_hybrid), $CONTROL_PAR_HIDE, $HIDE_WHOLE_CONTROL)
end if
$mbt_unison_analog := 0
$mbt_unison_digital := 0
$mbt_unison_hybrid := 0
select ($mn_unison)
case 0
$mbt_unison_analog := 1
case 1
$mbt_unison_digital := 1
case 2
$mbt_unison_hybrid := 1
end select
end function
on ui_control ($mbt_unison)
call mn_unison
end on
on ui_control ($mbt_unison_analog)
$mn_unison := 0
$mbt_unison := 0
call mn_unison
end on
on ui_control ($mbt_unison_digital)
$mn_unison := 1
$mbt_unison := 0
call mn_unison
end on
on ui_control ($mbt_unison_hybrid)
$mn_unison := 2
$mbt_unison := 0
call mn_unison
end on