Tutorials:Broadcasting Messages
From SMTheming Wiki
This technique only works in StepMania 4.0 and above (possibly in 3.95), so if you're working with StepMania 3.9, this tutorial isn't for you.
Introduction to MESSAGEMAN
MESSAGEMAN, or the Message Manager, controls the broadcasting of messages. In fact, the only Lua binding MESSAGEMAN has is Broadcast().
Broadcast() takes in at least one parameter, which is the message name.
An example of using Broadcast() for a simple message is MESSAGEMAN:Broadcast("Sample").
However, sometimes you may want to send extra data along with the message. The second parameter is a table that holds this information.
local msgParams = { HasGottenToasty = false, CurrentCombo = 249 }; MESSAGEMAN:Broadcast("ToastyCheck", msgParams); -- or alternatively: MESSAGEMAN:Broadcast("ToastyCheck", { HasGottenToasty = false, CurrentCombo = 249 } );
Catching Messages
Now that you know how to broadcast messages, you can learn to have theme elements handle them. To handle the message, you must create a *MessageCommand where * is the message's name.
Here is an example using the above ToastyCheck message:
LoadActor("_achievement toasty")..{ InitCommand=cmd(visible,false); ToastyCheckMessageCommand=function(self,param) local bHasToasty = param.HasGottenToasty; local iCurCombo = param.CurrentCombo; if iCurCombo >= 250 then -- do stuff here end; end; }

