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

Controlling AMP attack from table

Discussion in 'Scripting Workshop' started by Reylon, Sep 1, 2021.

  1. Reylon

    Reylon NI Product Owner

    Messages:
    124
    Hi Guys,

    I was wondering if it is possible to control the amp attack from the table. I thought it would be simple but I am missing something here...don't know what. The knob works just fine tho.
    Code:
    on init
     declare ui_table %Next[32] (5,2,100)
    
    declare ui_knob $Attack (0,1000000,1)
    end on
    
    
    on ui_control (%Next)
           set_engine_par($ENGINE_PAR_ATTACK,%Next[32],0,0,-1)
    end on
    
    on ui_control ($Attack)
           set_engine_par($ENGINE_PAR_ATTACK,$Attack,0,0,-1)
    end on
    
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    The table range needs to be 1000000 not 100.
     
  3. Reylon

    Reylon NI Product Owner

    Messages:
    124
    Hi Ed,

    I already tried that, doesn't seem to work :/
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Then also you're using the out of range array index in ui_control callback. Try %Next[0] and then adjust the first table index.
     
  5. Reylon

    Reylon NI Product Owner

    Messages:
    124
    Thank you ED,

    That did the trick. Is there a way to tell kontakt to go throught 0 to 31 without repeating the code line
    set_engine_par($ENGINE_PAR_ATTACK,%Next[0],0,0,-1)
     
  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Why would you go through the whole table?
     
  7. Reylon

    Reylon NI Product Owner

    Messages:
    124
    Im trying to create a special effect that will interact with another table :)
     
  8. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Could you explain a bit more? As it stands this makes no sense to me.
     
  9. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    It needs to do it in a loop then, not one line of code.