Basic group effects question

jjas7
jjas7 Member Posts: 4 Member
edited October 2024 in Scripting Workshop

I'm still learning...

I want to have this effect apply to all groups all the time. Do I use a while statement?

on init

make_perfview
set_script_title("FX")
set_ui_height_px(350)
  declare const $SK_SLOT := 0
  declare const $FX := -1
  declare const $GROUP := 0
  declare ui_knob $RotatorKnob (0,1000000,1)
  set_knob_unit($RotatorKnob,$KNOB_UNIT_PERCENT)
  set_knob_defval($RotatorKnob,500000)
  make_persistent($RotatorKnob)
  set_knob_label($RotatorKnob,get_engine_par_disp($ENGINE_PAR_RT_SPEED,$GROUP,$SK_SLOT,$FX))
end on

on ui_control ($RotatorKnob)
  set_engine_par($ENGINE_PAR_RT_SPEED,$RotatorKnob,$GROUP,$SK_SLOT,$FX)
  set_knob_label($RotatorKnob,get_engine_par_disp($ENGINE_PAR_RT_SPEED,$GROUP,$SK_SLOT,$FX))
end on


Comments

  • Gablux
    Gablux Member Posts: 88 Helper

    Exactly.

    on init
    
    make_perfview
    set_script_title("FX")
    set_ui_height_px(350)
      declare const $SK_SLOT := 0
      declare const $FX := -1
      declare const $GROUP := 0
    
        declare $i := 0 { a variable to count each while loop }
        declare const $MAX_GROUPS := 11 { the absolute number of groups }
    
      declare ui_knob $RotatorKnob (0,1000000,1)
      set_knob_unit($RotatorKnob,$KNOB_UNIT_PERCENT)
      set_knob_defval($RotatorKnob,500000)
      make_persistent($RotatorKnob)
      set_knob_label($RotatorKnob,get_engine_par_disp($ENGINE_PAR_RT_SPEED,$GROUP,$SK_SLOT,$FX))
    end on
    
    on ui_control ($RotatorKnob)
      $i := 0
      while ($i < $MAX_GROUPS)
        set_engine_par($ENGINE_PAR_RT_SPEED,$RotatorKnob, $i ,$SK_SLOT,$FX)
        inc($i)
      end while
      { the above loop will set groups from 0 to 10. it may seem confusing because MAX_GROUPS = 10
        but remember that group IDs are zero based, so if you have 11 groups and want to
        change the settings in all groups, you will be setting engine parameters for groups 0 to 10 }
    
      set_knob_label($RotatorKnob,get_engine_par_disp($ENGINE_PAR_RT_SPEED,$GROUP,$SK_SLOT,$FX))
    end on
    

    from the above you can derive further ideas.

  • jjas7
    jjas7 Member Posts: 4 Member
    edited October 2022

    Thank you Gablux!

    Actually, I received an error. Any idea why?


  • jjas7
    jjas7 Member Posts: 4 Member

    @Gablux Is there something missing in that line of code? Thanks!

  • Gablux
    Gablux Member Posts: 88 Helper

    It seems there is a strange character after the closing parenthesis on that line, check that. It should be empty after the parenthesis close, just a return carrier to the next line

  • jjas7
    jjas7 Member Posts: 4 Member

    It was some mysterious scripting program error. It works now. Thank you so much @Gablux!

This discussion has been closed.
Back To Top