Both sides previous revisionPrevious revisionNext revision | Previous revision |
4rpl:commands:setmsgbutton [2022/04/26 21:47] – [Description] Text format access and details to background color Vertu | 4rpl:commands:setmsgbutton [2025/02/14 14:57] (current) – external edit 127.0.0.1 |
---|
~~NOTOC~~ | ~~NOTOC~~ |
<=[[4rpl:start| Index]] | <=[[4rpl:start| Index]] \\ |
| <= [[4rpl:start#Messaging]] |
| |
:!: Available in version 2.3.2 and later. | :!: Available in version 2.3.2 and later. |
| |
===== Description ===== | ===== Description ===== |
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 [[4rpl:commands:sendmsg|SendMSG]]) when clicked if the msgChannel and msgText are set. \\ \\ | 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 [[4rpl:commands:sendmsg|SendMSG]]) when clicked if the msgChannel and msgText are set. |
**<fs medium>slot</fs>** : The slot number for the button. The slots range 0 to 11 inclusive. \\ | ? slot |
**<fs medium>enabled</fs>**: A Boolean indicating if the button is visible. All buttons are disabled by default. \\ | : The slot number for the button. The slots range 0 to 11 inclusive. |
**<fs medium>text</fs>**: 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 [[cw4:a.d.a_syntax_syntax_guide|implemented formatting]]. \\ | ? enabled |
**<fs medium>color</fs>**: 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(<color #ff5555>Red</color> <color #55ff55>Green</color> <color #6666ff>Blue</color> <color #999999>Opacity</color>((How "not transparent" the background is. An opacity of 0 is fully transparent/see-through, a value of 1 is fully Opacic/"not see through".))). 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.\\ | : A Boolean indicating if the button is visible. All buttons are disabled by default. |
**<fs medium>msgChannel</fs>**: The MSG channel to send the message on when clicked. \\ | ? text |
**<fs medium>msgText</fs>**: The string to send to the MSG channel. \\ | : 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 [[cw4:a.d.a_syntax_syntax_guide|text formatting]]. |
| ? color |
| : The background color of the button, expressed as a [[V4]] [[4rpl:commands:specialsyntax#vectors|vector]]. Each of the 4 fields is a floating-point value between 0 (zero) and 1 (one) indicating, respectively, the Red, Green, Blue and Alpha component values. Numbers larger than 1 are treated as 1. |
| ? msgChannel |
| : The MSG channel to send the message on when clicked. |
| ? msgText |
| : The string to send to the MSG channel. You must provide a non-empty string, otherwise the message will not be sent. |
| |
| |
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. | 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. |