KSP Scripts

Discussion in 'Kontakt' started by Clandestine, Mar 25, 2014.

  1. Clandestine

    Clandestine Platinum Record

    Joined:
    Nov 11, 2013
    Messages:
    717
    Likes Received:
    151
    Maybe a dumb question but am a bit new to this. Could anyone please tell the how to bypass a complete script say in script slot two, via a button or switch on the first script slot? What command would I use? Thanks in advance *yes*
     
  2.  
  3. franknitty69

    franknitty69 Newbie

    Joined:
    Feb 24, 2013
    Messages:
    116
    Likes Received:
    2
    scripts are processed from left to right. as long as the script in slot two is valid it will be processed.

    the entire script cannot be bypassed, for instance if there is an on init callback, it will be processed. but what you can do is set a flag in the rest of the code and check for that flag before doing something. you could also use the preprocessor USE_CODE_IF or USE_CODE_IF_NOT.

    variable
    so in slot 1, you have button. on the button's callback you set variable. so when enabled, variable = true, when disabled, variable = false. in the callbacks of slot 2 that you don't want processed, you check for the variable before you do anything.

    preprocessor
    using the preprocessor would work in the same manner as a variable, except you set the condition with a symbol. you set the symbol by using SET_CONDITION(<condition symbol>). say our symbol was slot_2_disabled...

    when the button is disabled, you say SET_CONDITION(slot_2_disabled) in the buttons callback. this makes slot_2_disabled = true. in slot 2 you would put your code in between:

    USE_CODE_IF_NOT(slot_2_disabled)
    ...
    END_USE_CODE
     
Loading...
Loading...