[grandMA3 Lua] Cannot assign FID to fixture via script — AddFixtures crashes / PatchTrySetID fails (v2.3.2.0)
Hi everyone,
I'm developing a Lua plugin for grandMA3 v2.3.2.0 that automates fixture creation in the patch. After days of exhaustive testing, I'm stuck on two fundamental issues.
Context: I want to duplicate a reference fixture (FID 1101) multiple times into specific groupings (FREE1 to FREE8), with automatic FID assignment (1101-1108 for LX1, 1201-1208 for LX2, etc.) and proper renaming.
Problem 1: AddFixtures() crashes the console
The official AddFixtures() function crashes MA3 whenever the navigation destination is correct (Stages.Stage 1.Fixtures). With incorrect navigation it returns nil without crashing. I've tried all navigation syntaxes:
lua
-- Official manual v2.3 syntax (crashes!)
Cmd("ChangeDestination Root")
Cmd('ChangeDestination "ShowData"."Patch"')
Cmd('ChangeDestination "Stages"."Stage 1"."Fixtures"')
local ok, r = pcall(AddFixtures, {mode=mode, amount=1, fid="9901", name="TEST"})
-- Console crashes, pcall doesn't catch it
The mode is obtained via Patch().FixtureTypes[typeIdx].DMXModes[modeIdx] → valid userdata.
Problem 2: Cannot assign a FID after fixture creation
The command copy refPath destPath /nc works and creates the fixture in the correct grouping, BUT with no FID (empty). All FID assignment attempts fail:
lua
-- PatchTrySetID → internal MA3 crash
-- attempt to index a nil value (local 'opt') at Patch@patch_common.lua:158
pcall(PatchTrySetID, handle, 1102) -- ok=false
-- set in patch context → Illegal object
CmdIndirectWait('set "Stages"."Stage 1"."Fixtures"."FREE1".2.FID 1102')
-- Direct Lua property assignment → ok=true but nothing changes
local ok, _ = pcall(function() fix2.FID = 1102 end) -- ok=true, FID unchanged
-- Assign /FID= → wrongly parsed by MA3 as ("D"="1102" /File)
-- set .INDEX → runs OK but doesn't affect FID
-- set .NO → expanded to "Normal", doesn't affect FID
What works:
- ✅ Deleting fixtures via ObjectList + CmdIndirectWait
- ✅ Renaming via
Cmd('Label Fixture X "name"') - ✅
copy refPath destPath /ncin patch context → creates copy in correct grouping - ✅
Patch().FixtureTypes[idx].DMXModes[idx]→ returns valid userdata - ✅
ObjectList,Patch().Stages[1].Fixtures["FREE1"]→ valid handles
Questions:
- Have you successfully used
AddFixtures()on v2.3.x? What exact navigation do you use? - Is there any method to assign a FID to an existing fixture with no FID, via Lua or command line?
PatchTrySetID— do you know the correct format for theoptparameter (line 158 of patch_common.lua)?
Thanks!