This is an old revision of the document!
⇐ Index
Available in version 2.3.2 and later.
SetMSGButton(<-slot <-enabled <-text <-color <-msgChannel <-msgText)
Sets the state of a MSG Button. MSG Buttons appear on the left of the display and to the right of the unit build pane. Up to 12 MSG buttons are supported. Each MSG button will send a 4rpl message (same as SendMSG) when clicked if the msgChannel and msgText are set.
slot : The slot number for the button. The slots range 0 to 11 inclusive.
enabled: A Boolean indicating if the button is visible. All buttons are disabled by default.
text: The text to appear on the button. Keep it short. It will wrap and the button height will stretch to accommodate the text. This has access to all of CW4's implemented formatting.
color: The background color of the button, a float from [0,1]. Any numbers above 1 are treated as 1. Should be a V4. Example: V4(1 1 1 1) would be white. V4(1 0 0 1) is red. V4(0 1 0 1) is green. V4(0 0 1 1) is blue. V4(Red Green Blue Opacity1)). The background color has visual details and won't ever be fully saturated with color, meaning red text on a red background will be clearly visible.
msgChannel: The MSG channel to send the message on when clicked.
msgText: The string to send to the MSG channel.
MSG buttons persist across save/load. So you can set the MSG buttons once from script and they will be present for the rest of a game, even across saves.
:once RegisterForMSG("TestChannel" "MessageCallback") SetMSGButton(0 true "Thingy 0" V4(1 1 1 1) "TestChannel" "Hello From Thingy0") SetMSGButton(5 true LF "<size=125%><color=green>Thingy 5" LF " " concat concat concat V4(1 1 0 1) "TestChannel" "Hello From Thingy5") :MessageCallback traceallsp("Message Received: " <-_DATA)
⇐ Index