GetParameterText() for discrete Scriptlet parameters returns empty string for higher half

Hi,

It looks to me like there is a small bug in scriptlet together with rackscript. I declare a scriptlet parameter like this in a script with handle ‘Labels’:

var something : Discrete Parameter "None", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8" = "None"

Then I declare a ‘listener’ for Plugin events:

// Called when a plugin block parameter value has changed
On ParameterValueChanged(parameterNumber : integer, parameterValue : double) from Labels
    if parameterValue != 0 then
        display.SetWidgetLabel(GetParameterText(Labels, parameterValue))
        Labels.SetParameter(0, 0)
    end
End

When the scriptlet parameter ‘something’ changes only the texts “None”, “l1”, “l2” and “l3” are retrieved by GetParameterText(Labels, parameterValue).

This is everything with parameterValue < 0.5.

Is this expected behavior?

I have created a sample gig:
debugScriptLets.gig (18.0 KB)

Update. I have submitted a support-request also, so if that is the appropriate way to report this, then ignore this.

The function GetParameterText needs the index of the parameter you want to retrieve e.g. an integer representing the parameter order. You are passing it the parameter value, which is also a double. The only reason why it was working for the first 4 labels is because the parameter value was getting rounded down to zero (as the function was expecting an integer).

Change it to parameterNumber or hardcode it to 0 like you’ve done on the SetParameter function below it.

GetParameterText : Gets the value as text of the given parameter index of the plugin block if available.

1 Like

It will work properly if you modify your Script as follows:

On ParameterValueChanged(parameterNumber : integer, parameterValue : double) from Labels
    if parameterValue != 0 then
        display.SetWidgetLabel(GetParameterText(Labels, parameterNumber ))
        //Labels.SetParameter(0, 0)
    end
End

I want to agree with you, but it doesn’t. Labels.SetParameter(0, 0) is only meant to make it retriggerable (that is du-nglish :slight_smile: ), but I tried but also with commenting it out, it is not working. I’m afraid it is not that easy. Also interesting is that ‘l1’, ‘l2’ and ‘l3’ are getting retrieved, where ‘l4’ and ‘l5’ aren’t. The value ‘None’ I’m not too much interested in. As I said, that is just to make it retriggerable.

Hi,

Thanks for replying, but the parameter is zero (0), it is the only one on the scriptlet. Please see the gig I attached… Furthermore, ‘l1’, ‘l2’ and ‘l3’ do retrieve, so it is not that simple

Maybe the attached project is not too clear: Please open the ‘interface’ of the scriptlet ‘Trigger’ and try the triggers for l1, l2 … l7

Please, keep in mind that it is just a showcase for the described feature/bug. Not something I’m using for production, so the coding is not very neat, and for this particular case, there are other ways to accomplish this.

@Frank1119, we won’t try to debug you GPScript here, especially because we don’t know at all what you are trying to achieve. We only answered about what you considered to be a bug. On this specific point, things seem to be OK. Here is the result applying my proposed modification:

GetParameterText

That is simply wrong As has been pointed out to you, GetParameterText requires a parameter number, not a parameter value, the latter which is always only between 0.0 and 1.0

Changing it to

display.SetWidgetLabel(GetParameterText(Labels,parameterNumber))

works just fine

2022-07-04 10-42-14.2022-07-04 10_42_38

Now I get it. Stupid me, Bang me on the head, and I’ll get it. In this case, I could even simply hardcode the parameter number. Mea Culpa and many thanks

You were right. Sorry I overlooked parameterValue vs. parameterNumber. Thanks