Welcome to the new and improved Native Instruments online community. Join our active forum of 40,000+ members for discussions and much more.

KSP SCRIPT WARNING, help please!

leon59 Member Posts: 17 Member
edited February 6 in Scripting Workshop


I am new to KSP but I cannot seem to find the answer to this problem I am having in the KSP manual or online. If somebody could assist I would be most grateful. Thank you

I have a menu with left and right scroll buttons. 128 groups. If I press the left arrow / button when group 1 is selected or the right button when group 128 is selected I get this script warning. " SCRIPT WARINING ( Line: xxxx, Script : 0): Invalid ui_menu value! Assignment has no effect. My question is why and how do I stop this from happening?


  • Gablux
    Gablux Member Posts: 39 Member

    It looks like you forgot to treat those cases in your logic.

    If you decrease the menu value counter forever, soon enough you will hit a number that is not there. Same for increasing the value of the counter.

    Resolved with a simple conditional statement like (pseudo-code)

    if counter < min_menu_value then min_menu_value - min_menu_value

    same for the increasing side.

  • leon59
    leon59 Member Posts: 17 Member

    Hi Gablux,

    Thank you for your reply. I get the idea but I'm not quite sure where this code goes. Is it under $PrevMenu := 0 ie: if($PrevMenu1 < 0 then 0 - 0). Sorry but like I say I'm really new to all of this but, this is the last issue as far as I can tell with my custom instrument which has taken me a couple of weeks to code from scratch ( with the help of many great posts in the forums :) )

    on ui_control($PrevMenu1)
    $menu1 := (get_control_par(get_ui_id($menu1),$CONTROL_PAR_NUM_ITEMS)+$menu1-1) mod get_control_par(get_ui_id($menu1),$CONTROL_PAR_NUM_ITEMS)
    $PrevMenu1 := 0
    $i := $LAYER1_FIRST
    while ($i<=$LAYER1_LAST)
    end while
    end on

  • leon59
    leon59 Member Posts: 17 Member

    Ok managed to sort it out. Thank you.

Back To Top