Setting Parameters in Midi Module "Layer Alternate"

I am relatively new to Halion Lua scripting (but relatively old to scripting in general ;-))
I am trying to create a “Layer Alternate” MidiModule in code and then set the parameters:

  • Alternation Mode: Random Exclusive
  • Enable: activated
  • Alternation List: A list of Layers that I already have access to programmaticaly

I tried something like:

if (grouplayer) then
		local midiMod = MidiModule('Layer Alternate')
		midiMod:setName("Layer Alternate")
		midiMod:setParameter("Mode", "Random Exclusive")
		midiMod:setParameter("Enable Key", true)
		midiMod:setParameter("Alternation", {})

But this only works for setting the Name.
Is there any reference in the documentation where I can see the exact names and value ranges of all parameters that can be set in the midi module “Layer Alternate”?

Thanks for any help!

You can check the parameters in parameters list.

You could try like this:

layerAlternate = MidiModule("Layer Alternate")
layerAlternate:setName("Layer Alternate")

layers = this.parent:findLayers()
altdata = {}
for i = 1, #layers do
    altdata[i] = {keyswitch = -1,   layer = layers[i]}

layerAlternate:setParameter("AlternateData", altdata)
layerAlternate:setParameter("AlternationMode", 3)
layerAlternate:setParameter("EnableKey", -1)

Also this might give you some ideas.

1 Like

Dear @misohoza , thank you very much for the fast and detailled response which just worked 100% perfectly!