Unable to move or add pictures to UI slider

jspro
jspro Member Posts: 5 Member
edited May 2022 in Scripting Workshop

Hello all,

Please can you help with a KSP issue I am having. I have declared a ui_slider and I am unable to move it or add a photo to it on the script. No errors are coming up on the KSP Script when applying in Kontakt.


declare ui_slider $Rate_knob (0,100)

{ set_text ($Rate_knob,"Rate")}

make_persistent ($Rate_knob)

declare $Rate_knobID 

$Rate_knobID := get_ui_id($Rate_knob)

%arpeggiator_control_IDs[$k] := $Rate_knobID

inc ($k)

set_control_par_str(get_ui_id($Rate_knobID),$CONTROL_PAR_PICTURE,"rate")

set_control_par(get_ui_id($Rate_knobID),$CONTROL_PAR_WIDTH,43)

set_control_par(get_ui_id($Rate_knobID),$CONTROL_PAR_HEIGHT,43)

{ set_control_par_str(get_ui_id($Rate_knobID),$CONTROL_PAR_TEXT,"rate")}


move_control_px($Rate_knob,105,279)

Comments

  • corbo-billy
    corbo-billy Member Posts: 83 Helper
    edited May 2022

    A small error for the image code, it should :


    set_control_par_str(get_ui_id($Rate_knob),$CONTROL_PAR_PICTURE,"rate")

    or

    set_control_par_str($Rate_knobID,$CONTROL_PAR_PICTURE,"rate")


    And it all depends on what you want to do but for a slider, it is recommended:

    declare ui_slider $Rate_knob (0,1000000)

  • jspro
    jspro Member Posts: 5 Member

    Thanks so much!

  • corbo-billy
    corbo-billy Member Posts: 83 Helper

    Is it working fine ?

  • jspro
    jspro Member Posts: 5 Member

    Im now able to add graphics to the Rate_knob - however still unable to move it. KSP is saying there is an error if I use:

    move_control_px($Rate_knobID,105,279)

    So I've entered

    move_control_px($Rate_knob,105,279)

  • corbo-billy
    corbo-billy Member Posts: 83 Helper

    Yes, your second solution should work better .

  • EvilDragon
    EvilDragon Moderator Posts: 1,017 mod

    You can only use literal UI widget names with move_control_px, not UI IDs. For UI IDs you need to use set_control_par().

  • jspro
    jspro Member Posts: 5 Member

    Okay cool, that makes sense. I'm still unable to move the slider though- there is no error in the script. Could something else be stopping it? Im having this problem elsewhere too within the instrument

Back To Top