#✅ | change button text depending on setting

1 messages · Page 1 of 1 (latest)

worn crowBOT
#

You can make the button label react to your setting value by using the switch_case placeholder together with the getvariable placeholder (assuming the setting value is stored in a FancyMenu variable). Here’s how to do it:

  1. Store the setting value in a FancyMenu variable (see the Variables page). When the value changes (e.g., via a slider or button action), update that variable with Set Variable Value.

  2. Set the button’s label to a placeholder that reads the variable and returns the right text. For example:

    {"placeholder":"switch_case","values":{
      "value":"{"placeholder":"getvariable","values":{"name":"your_setting_var"}}",
      "cases":"1:&lDisabled,2:&lMiddle,3:&lEnabled",
      "default":"&lUnknown"
    }}
    
    • &l forces Minecraft’s bold formatting, which works for button labels (you don’t need to mess with JSON components for this).
    • Replace your_setting_var with the actual variable name.
    • Adjust “Middle” to whatever you want to show for the value 2.
  3. If you want to avoid hard-coding strings in the cases value, you can also nest local placeholders or other text helpers inside the switch_case, but the above is the simplest for plain text.

This keeps the button always bold, and the text automatically updates whenever the underlying variable changes. 😊

worn crowBOT
#
Thread Marked as Solved

This support thread has been marked as solved by @ornate dock.

The AI helper is now disabled, but you can still continue the conversation if needed. Thank you for using our support system!