Next revision | Previous revision |
4rpl:commands:setmsgbutton [2022/04/24 18:17] – created virgilw | 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 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. |
**slot** : The slot number for the button. The slots range 0 to 11 inclusive. \\ | ? slot |
**enabled**: 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. |
**text**: The text to appear on the button. Keep it short. It will wrap and the button height will stretch to accommodate the text. \\ | ? enabled |
**color**: The background color of the button. 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. \\ | : A Boolean indicating if the button is visible. All buttons are disabled by default. |
**msgChannel**: The MSG channel to send the message on when clicked. \\ | ? text |
**msgText**: 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. |