/ HALion Developer Resource / HALion Script / Reference /

assignAutomation

assignAutomation(element, nameOrID, index, scope)

Description

Function to assign a parameter to an automation parameter. The arguments element and nameOrID specify the parameter to be assigned. The index argument determines to which automation parameter the parameter will be assigned. If the index argument is nil or not set, the parameter will be assigned to the next free automation parameter. The scope determines the part of the program that will be affected by the automation parameter. You specify the scope by setting the scope argument to the Element object that corresponds to the desired part of the program. The function returns the index to which the automation parameter was assigned to. This is useful if the automation parameter was assigned to the next free automation parameter.

Available in: Controller.

Arguments

ArgumentDescriptionValue Type
elementThe Element object of the parameter to be assigned.Element
nameOrIDThe name or ID of the parameter.string or number
indexThe index of the automation parameter, or nil.number or nil, optional
scopeThe Element object that will be affected by the automation parameter. (Since HALion 6.1)Element

Return Values

Returns the index to which the automation parameter was assigned to.

Example

-- Assign filter cutoff, resonance and envelope amount to the next free automation.
zones = this.program:findZones(true)
parameters = { "Filter.Cutoff", "Filter.Resonance", "Filter.EnvAmount" }
for i, parameter in ipairs(parameters) do
    local automationIndex
    automationIndex = assignAutomation(zones[1], parameter, automationIndex, this.program)
end

See also: forgetAutomation, getAutomationIndex