Renaming FlexPhraser Variation via script. Unsure what to define as zone/parent

I have a menu dropdown assigned to the FlexPhraser Variation which instead of numbering from 1 to 8, numbers as 0 to 7.

image

In order to make this more clear to the user I’d like to create very basic script to rename/number from 1 to 8.

This is what I have so far. I believe the issue is with the “parent” component but I could be wrong.
I confirm the Flex Phraser is called FlexPhraser.

flexActiveStateValues = {0, 1, 2, 3, 4, 5, 6, 7}
flexActiveStateNames = {“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”}

flex = this.parent:getMidiModule(“FlexPhraser”)

function flexNameChanged()
flex:setParameter(“FlexPhraser.ActiveState”, flexActiveStateValues[ActiveState])
end

defineParameter(“ActiveState”, nil, 1, flexActiveStateNames, flexNameChanged)

Do you have the parameter name correct?
(“FlexPhraser. ActiveState”)
It probably should be just “ActiveState”.

If you use setParameter and such parameter doesn’t exist then nothing will happen.

Also in this case you are not trying to filter any options/values. You can do it without the values table.

flex:setParameter("ActiveState", ActiveState - 1)
1 Like

Perfect. I ended up getting both methods to work but will ultimately go with the simplified (second) version. You were absolutely right about “FlexPhraser.ActiveState” too. That was a silly mistake I missed when double checking the attributes.

Original version:

flexActiveStateValues = {0, 1, 2, 3, 4, 5, 6, 7}
flexActiveStateNames = {“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”}

flex = this.parent:getMidiModule(“FlexPhraser”)

function flexNameChanged()
flex:setParameter(“ActiveState”, flexActiveStateValues[ActiveState])
end

defineParameter(“ActiveState”, nil, 1, flexActiveStateNames, flexNameChanged)

Simplified version:

flexActiveStateNames = {“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”}

flex = this.parent:getMidiModule(“FlexPhraser”)

function flexNameChanged()
flex:setParameter(“ActiveState”, ActiveState - 1)
end

defineParameter(“ActiveState”, nil, 1, flexActiveStateNames, flexNameChanged)