How to connect a custom script parameter and a QC knob?

In a script module I put the following code to connect the firs QC knob to my custom VolumedBControl parameter:

defineParameter(“VolumedBControl”, nil, 0, -100, 0, 0.1)

module = this
layers = this.parent:findLayers(true)

layers[1]:addQCAssignment(1, module, “VolumedBControl”, layers[1])

But as I turn the QC I see in the Parameter List that VolumedBControl doesn’t change at all. What am I doing wrong? With this I just would like to tweak and pick necessary values of VolumedBControl without creating a MacroPage knob, just using a built-in QC knob. Is it possible?

Did you set the quick control mode to absolute? You may not see any change if the mode is relative.

That’s the screenshot of Quick Control Assignments section:

The mode is Absolute, but I see that Quick Control Parameter is indicated as “invalid” and Affected Layers/Modules field is wrong (it’s set to Layer 1, meanwhile it should be Lua Script module, I think)

I’ve created a Knob at the MacroPage using the factory template. Connected it to VolumedBControl parameter and the Knob works as expected. But when I right-click it and assign to QC1, the QC1 knob itself doesn’t affect neither VolumedBControl parameter nor the MacroPage knob. Although the QC1 label fetches the VolumedBContro name and is shown in the popup tool-tip. Strange…

Just tried assigning a script parameter to a quick control. It works but you should probably set the scope (last argument of addQCAssignment) to the script module instead of layer.

When set to relative mode it doesn’t show any change in parameters list but it works. The parameter callback was executed when moving the quick control.

Also when assigning quick controls from the script you may want to check if the assignment already exists to avoid duplicate assignment.

Could you please show the script how to put module in the scope rather than layer? ‘Cos smth like this doesn’t work giving an error:

layers[1]:addQCAssignment(1, layers[1], “VolumedBControl”, module)

Also I’m a bit perplexed should the Lua module and layer be at the same tree level or the layer should be the parent one while module must be its child?

I tried like this:

defineParameter("P", nil, 0, 0, 100, function() print(P) end)

while this.parent:getNumQCAssignments(1) > 0 do
	this.parent:removeQCAssignment(1, 1)
end

this.parent:addQCAssignment(1, this, "P", this)
-- following should also work
-- this.parent:addQCAssignment(1, this, "P", this.parent)

this.parent:setQCAssignmentMin(1, 1, 50)
this.parent:setQCAssignmentMax(1, 1, 100)

The second argument of addQCAssignment needs to be the element with the parameter you want to connect, in this case the script module.

The last argument is the scope. You can use either the script module again or its parent layer (program).

Yes, if you want to use the layer quick controls the script module should be its child. That’s probably why it says it’s invalid assignment.

Yes, it worked. Thanks! Could you please explain one thing:

In addQCAssignment the last argument is the element to be affected by QC (the MidiModule in my case). It’s like a target. And this.parent:addQCAssignment() is the source chosen (a QC knob of Program layer). But what is exactly the second argument in simple words? Which according to the manual is “The Element object of the parameter to be connected”. Why is it again the MidiModule?

You could connect a zone/layer/bus/effect… parameter. In this case it’s a script parameter. That’s why the element is the script module.