1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Newbi question: Create a "n" line text from which you can choose among options

Discussion in 'Scripting Workshop' started by Alex_Kay, Apr 18, 2015.

  1. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Nevermind guys! Another guy helped me out!
     
  2. Big Bob

    Big Bob Forum Member

    Messages:
    606
    HI Alex,

    Just what do you mean by 'background image'? Are you talking about wallpaper? If so, you shouldn't be having thise problem because all controls sit at a higher Z level than the wallpaper. However, if your 'background image' is some other label that you have re-skinned, then you have to be sure that it is declared ahead of the "No reverb selected" label. AFAIK, Labels stack in the order declared from bottom to top.

    Rejoice,

    Bob
     
  3. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Thank you Bob for your reply!

    As you clearly comprehend my problem, I was using reskinned label as a wallpaper. And yes, the declaration was the answer!
    Do you have any idea where the impulse responses of Konakt are located?

    I tried the C:\Users\user\Documents\Native Instruments\Kontakt 5\presets\Effects\Convolution

    but I couldn't find any wav file!

    Thank you!

    EDIT: NEVER MIND Bob, I figured it out! :)
     
    Last edited: May 11, 2015
  4. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Bob,

    I know that I'm a pain in the @ss!

    I've written the follow code:
    Code:
    on init
      make_perfview
      declare ui_knob $test1(0, 100, 1)
      declare ui_slider $test2(0, 100)
      declare ui_slider $test3(0, 100)
      declare ui_slider $test4(0, 100)
      declare ui_slider $test5(0, 100)
      declare ui_button $buttonhide
      declare $r
      declare !hidetest[5]
      !hidetest[0] := "$test1"
      !hidetest[1] := "$test2"
      !hidetest[2] := "$test3"
      !hidetest[3] := "$test4"
      !hidetest[4] := "$test5"
    end on
    
    on ui_control($buttonhide)
      if ($buttonhide=0)
        while ($r<5)
          move_control(!hidetest[$r],0,0)
          inc($r)
        end while
      end if
      if ($buttonhide=1)
        while ($r<5)
          move_control(!hidetest[$r],1,1)
          inc($r)
        end while
      end if
      $r := 0
    end on
    but I can't make it work! Is it possible to put a STRING ARRAY inside a move_control, instead of a variable?
     
  5. Big Bob

    Big Bob Forum Member

    Messages:
    606
    No, you can't use a string variable in place of the control's name. However, if you want to use a loop to hide/show all the controls, you can save the control's id in an array like this:
    Code:
      declare test_ids[5]
      declare ui_knob test1(0, 100, 1)
        test_id[0] := get_ui_id(test1)
      declare ui_slider test2(0, 100)
        test_id[1] := get_ui_id(test2)
      declare ui_slider test3(0, 100)
        test_id[2] := get_ui_id(test3)
      declare ui_slider test4(0, 100)
        test_id[3] := get_ui_id(test4)
      declare ui_slider test5(0, 100)
        test_id[4] := get_ui_id(test5)
    Then in your while loop body, instead of move_control(!hidetest[$r],0,0) and move_control(!hidetest[$r],1,1), you can use:
    test_id[r]->hide:= 16 to hide the control and test_id[r]->hide := 0 to show the control. Of course this syntax assumes that you are using NIls' editor.

    Rejoice,

    Bob
     
    Last edited: May 14, 2015
  6. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Thank you Bob!
     
  7. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Bob!

    After a two weeks of absence in this forum, I'm coming back with another question!

    I've written this code:
    Code:
    on init
        message("")
        set_ui_height_px(100)
        declare ui_slider $test(0, 199)
        declare $direction
        declare $tick_counter
        set_listener($NI_SIGNAL_TIMER_MS,10000)
        set_control_par_str(get_ui_id($test),$CONTROL_PAR_PICTURE,"Test Action Guitars2")
        declare $note_count
        $note_count:=0
    end on
    
    on note
        inc($note_count)
        $test:=0
        while ($NOTE_HELD = 1)
            inc($tick_counter)
            $test := $tick_counter
            wait (10000)
            if ($tick_counter=199)
                $tick_counter := 0
            end if
        end while
        if($NOTE_HELD = 0)
            $test:=0
            $tick_counter:=0
        end if
        message ($note_count)
    end on
    with which I make the slider increasing while the note is held.
    Is there a way to DEACTIVATE the slider for use by the user?

    In addition, apart from the KSP reference manual, is there anything else I could read in order to bug you less? :)

    Cheers,
    Alex
     
  8. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    If you don't want something to be interactive, use ui_label, not ui_slider, then change $CONTROL_PAR_PICTURE_STATE instead of increasing the value of slider.
     
    • Like Like x 1
  9. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Will try that!
    Thank you very much!
     
  10. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Mario (EvilDragon) and Bob!

    I'm here to bug you for a long time! :)

    I'm coming back with another question.
    Is it possible to change the FONT_TYPE of a single line on a ui_label?

    Say that I have an ui_label with 4 lines and a slider attached to it (the movement of the slider will "get" you the corresponding line of the ui_label).
    However, I would like with every selection of the slider, the FONT_TYPE of the line selected inside the ui_label to change.

    Is it possible? (Is my english correct and comprehensible to you?)

    Cheers,
    Alex
     
  11. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Font type cannot be changed multiple times for different characters within the same label. You will need another label if you want that. However, if you want to just change the font of a label depending on slider position, you can of course do that (I presume you want to use a different color for the "selected" line).
     
  12. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Thank you!
     
  13. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Mario and Bob!

    I read on the KSP reference manual about saving presets on a table, but I can;t see anywhere about saving all the parameters of the knobs and sliders as presets.
    Any ideas?
     
  14. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Same thing - store the value of parameters into an array.
     
  15. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    But as stated in the KSP manual, I cannot store a variable inside an array.
     
  16. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Sure you can. You even have an example of that in explanations of load_array() and save_array() commands!
     
  17. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Ok, I'll check it out! Thank you for the info!
     
  18. showard

    showard NI Product Owner

    Messages:
    69
    Big Bob: I'm trying your ListBoxDemo#4.zip
    Here's a piece of your code (from the ListBoxDemo#4.ksp file) ...
    on init
    message('')
    set_ui_height_px(435)
    make_perfview

    declare const MaxLine := 11 { max line index }
    declare const X := 165 { XY panel position for ListBox }
    declare const Y := 10

    Notice that the variables are un-typed. Don't they need $ for integers, % for int arrays, etc.?
    As the code stands, the Kontakt editor won't compile it!
    There must be something I don't understand. Can you assist?
     
  19. Big Bob

    Big Bob Forum Member

    Messages:
    606
    The script is in KScript Editor (KSE) source format so you need to first load the script into NIls' editor and hit F5. That will convert the source code to KSP-compatible source code and place it in the clipboard. Then you can paste the clipboard into Kontakt's editor and hit Apply and everything should fly:cool:.

    Rejoice,

    Bob
     
  20. Alex_Kay

    Alex_Kay Member

    Messages:
    30
    Hi Bob and Mario!

    I'm back with another question!
    Is it possible to reproduce a sound from another midi channel?
    For example, lets say that I have a solo violin on channel 1 and a new instrument on channel 2. Can I play the sounds of channel 1, via channel 2?

    Thank you!