Script to cycle through parameters with button press

hey, any help would be super appreciated, I’m really new to GP and scripting. I just need a simple script that everytime I press a button it activates the next paramete, it doesn’t need to even disengage the last parameter because by selecting the next parameter it will auto disengage the previous in the vst. I need this to happen 4 times before cycling back to the first one. Each parameter is just a plus one of the previous except for the last one that cycles back. Please help I’m so lost.

Hi @jjmusic, welcome to the GP community forum :wink:

If you are new to using GP, my first advice would to try everything you can not to use any scripting before your master everything in GP. Usually scripting is not needed to use GP. Also don’t think a GPScript is simple if you are new to scripting.

Having said that, perhaps you could explain a bit more what you are trying to achieve. What plugin are you using ? Which parameters are you talking about ? What do you mean by “activate a parameter” and “disengage a parameter” ? If you give use more information, it will be much easier to help you.

2 Likes

I’m using ddelay a free plug in. Changing the delay from free to dotted to triplet to standard are each a different button in the interface. activating one button deactivates the last. I am trying to get a button to cycle through those options.

Do you mean deelay ?

oops, yup. That is the plug in I’m talking about haha

With this rackspace script you can achieve what you want

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   DEELAY : PluginBlock
   BUTTON : Widget
//$</AutoDeclare>

// Called when a single widget value has changed
On WidgetValueChanged(newValue : double) from BUTTON
 if newValue == 1.0 then
  if GetParameter(DEELAY,26) == 1.0 then
    SetParameter(DEELAY,27,1.0)
  elsif GetParameter(DEELAY,27) == 1.0 then
    SetParameter(DEELAY,28,1.0)
  elsif GetParameter(DEELAY,28) == 1.0 then
    SetParameter(DEELAY,26,1.0)
  end  
 end
End


Create a button widget and give it the OSC/GPScript Name BUTTON

https://gigperformer.com/docs/GPScript45/LanguageManual/

thank you so much for creating that, but unfortunately I can’t get it working. I have this script working properly on the same plug in to control multiple knobs at once, so I don’t think it’s my implimention of the script onto a button

Var

time : Widget

DEELAY : PluginBlock;

On WidgetValueChanged(newValue : double) from time

SetParameter(DEELAY, 17, newValue)

SetParameter(DEELAY, 18, newValue)

SetParameter(DEELAY, 19, newValue)

SetParameter(DEELAY, 9, newValue)

i see the logic of your script but for some reason it just isn’t changing when I push the button

please upload the gig file

unfortunately it seems that as a new user I can’t upload…

please login again

Did you copy and paste the GPScript posted by @pianopaul or did you copy it by hand?

i copied and pasted it
Standard.gig (2.7 MB)

the version in here is slightly edited but all I did was correct the parameter numbers, and added an iteration so all four parameters would be cycled through, it didn’t work before that either but I thought that might be the problem, you can replace it with your copied and pasted script above if you want to double check me

There is no problem in the original GPScript from @pianopaul. Try to use it as it is.

You must not map the widget called BUTTON to the plugin!
And just activate 1 trp or dor or nrm in the plugin.
Then it is working.