KSP: Custom switch is cropped by row height

Studio KRUT
Studio KRUT Member Posts: 7 Newcomer
edited September 28 in Scripting Workshop

Trying to get into KSP. I have managed to set my custom knobs (aka sliders) but the switches seems to get cropped along a grid. They are png-strips with 6 sprites. The mouse over animation is working, I see the frames aree changing.

But I can't figure out how to allow them to occupy the full height, i.e. not be cropped. Each frame is 68x130px. I tried to set CONTROL_PAR_HEIGHT as I saw in an example on yummybeats, but to no effect.

What am I missing?

script as written in sublime:

on init






   declare ui_slider $cc1_knob (0,127)

   declare ui_slider $cc2_knob (0,127)





   declare cc1_ch := 74

   declare cc2_ch := 71

   declare $cc1_knobId

   $cc1_knobId := get_ui_id($cc1_knob)

   set_control_par_str($cc1_knobId, $CONTROL_PAR_PICTURE, "gui-knob")                  


   declare $cc2_knobId

   $cc2_knobId := get_ui_id($cc2_knob)

   set_control_par_str($cc2_knobId, $CONTROL_PAR_PICTURE, "gui-knob")                  


   declare ui_switch sw_tuned


   set_control_par_str(get_ui_id(sw_tuned), $CONTROL_PAR_PICTURE, "gui-switch-v")



   declare ui_switch sw_efkt1


   set_control_par_str(sw_efkt1, $CONTROL_PAR_PICTURE, "gui-switch-v")

   declare ui_switch sw_efkt2


   set_control_par_str(sw_efkt2, $CONTROL_PAR_PICTURE, "gui-switch-v")

   move_control(cc1_knob, 4, 2)

   move_control(cc2_knob, 5,2)

   move_control(sw_tuned, 1,2)

   move_control(sw_efkt1, 2,2)

   move_control(sw_efkt2, 3,2)






   set_control_help(cc1_knob,"Crossfade between articulations" )

   set_control_help(cc2_knob,"We don't know yet" )

   set_control_help(sw_tuned,"Switch tune correction on/off" )

   set_control_help(sw_efkt1,"effect number one" )

   set_control_help(sw_efkt2,"effect number two")

end on

on ui_control (cc1_knob)

   set_controller(cc1_ch, cc1_knob)

end on

on ui_control (cc2_knob)


end on

on controller

   if CC_NUM=cc1_ch

      set_controller(cc1_ch, cc1_knob)

   end if

   if CC_NUM=cc2_ch

      set_controller(cc2_ch, cc2_knob)

   end if

end on

on ui_control (sw_tuned)

end on

on ui_control (sw_efkt1)

end on

on ui_control (sw_efkt2)

end on

on note


   if sw_tuned=0








   end if

end on


  • Gablux
    Gablux Member Posts: 63 Member

    A few things to double check:

    • in the text file with the same name as the PNG, is the number of animations correct?
    • same text file, "Horizontal Animation: no"
    • check that the height you are setting with $CONTROL_PAR_HEIGHT (130) is correct. Your PNG would have to be 780px tall. (130x6)
    • You are not setting the width and height of the efkt1 switch.

    Extra: you probably want to set the text for these buttons as "" (empty)

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

    Or in the text file, a blank tenth line present can improve things sometimes.

  • Studio KRUT
    Studio KRUT Member Posts: 7 Newcomer


    I had number of animations at 6 and I had the blank tenth line. Also png was 780 px tall.

    I didn't see that I missed setting height and width on efkt1, but I guess the "sw_tuned" would be correct...

    What I ended up doing was making all switches horizontal instead. So solved by a compromise for this time.

Back To Top