The CodeMessageCommand part should be in a BGAnimation-side lua script, e.g.
local t = Def.ActorFrame{
Def.Actor{
Name="CodeController";
CodeMessageCommand=%function(self, param)
Trace("CodeMessageCommand received.")
local codeName = param.Name -- code name, matches the one in metrics
local pn = param.PlayerNumber -- which player entered the code
end
};
};