This macro displays a link or, optionally, a button. The link or button can be clicked to display a message immediately below it in the passage text, and clicked again to collapse the message.
Author | ChapelR |
Website | https://twinelab.net/custom-macros-for-sugarcube-2/#/message-macro |
Story format | SugarCube 2 |
Last checked | Sun May 19 2019 |
License | Unlicense |
Download | message.zip |
This macro displays a link or, optionally, a button. The link or button can be clicked to display a message immediately below it in the passage text, and clicked again to collapse the message.
Message content is given the class .message-text
; you can control the appearance of the message's content using this selector in your CSS. (For example: .message-text {color: green;}
would render the text of all messages in green).
You can alter the setup.messageMacro.default
configuration option in your story JavaScript to change what the default link text is when you omit the argument.
// <<message>> macros without linkText arguments will display `YAY`:
setup.messageMacro.default = 'YAY';
Demo Twee code:
:: Start <<message 'Click me!'>>You get this cool message! You can click again to hide me.<</message>>