on persistence_changed, select button

Options
composer808
composer808 Member Posts: 8 Newcomer

Hi everybody! I'm looking to select a button by default. I'd been using an "on persistence_changed" then "play_note" to trigger a keyswitch

on persistence_changed
	play_note (0,127,0,0)
    end on

But as EvilDragon pointed out, this play_note interferes with the ks_list. And I'd much rather select a button on default, something like this...

on persistence_changed
	sel_btn = 0
    end on

Does anyone have any suggestions on how to do this properly? Thank you!

Best Answer

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod
    edited February 2022 Answer ✓
    Options

    If you have your keyswitch stored in a persistent variable, all you need to do is loop through all your (I'm assuming articulation) buttons and set the right one to 1. For example:

    for i := 0 to NUM_ARTICS - 1
        if i = sel_ks
            ID[i] -> value := 1
        else
            ID[i] -> value := 0
        end if
    end for
    

    This example assumes SublimeKSP usage.

    Also, in this case, your buttons don't even need to be made persistent, as long as your sel_ks is persistent.

Answers

  • EvilDragon
    EvilDragon Moderator Posts: 1,023 mod
    edited February 2022 Answer ✓
    Options

    If you have your keyswitch stored in a persistent variable, all you need to do is loop through all your (I'm assuming articulation) buttons and set the right one to 1. For example:

    for i := 0 to NUM_ARTICS - 1
        if i = sel_ks
            ID[i] -> value := 1
        else
            ID[i] -> value := 0
        end if
    end for
    

    This example assumes SublimeKSP usage.

    Also, in this case, your buttons don't even need to be made persistent, as long as your sel_ks is persistent.

Back To Top