#✅ | Custom buttons mapped to boolean values

1 messages · Page 1 of 1 (latest)

loud wasp
#

hey, im currently doing a complete overhaul of the settings menu + its sub menus (online, skin settings, etc), and when im trying to create the buttons to toggle certains values on or off, im noticing that while i can find the option name, i dont know how to get the button to act as a boolean (so changing a option value from on -> off and off -> on)

how would i go about doing this?

red saffronBOT
#

Hi! 👋 Please first click the button below to start this support ticket.

⚠️ It is not possible for anybody to send messages in this ticket before it has been started, so you need to click the button for others to be able to help/answer you.

red saffronBOT
# loud wasp hey, im currently doing a complete overhaul of the settings menu + its sub menus...

Yes, use the current Minecraft option value in an IF/ELSE action script, then set the opposite value.

Example: toggling a boolean option

Let’s use pauseOnLostFocus as the option name.

  1. Create or select your custom button.
  2. Right-click it → Manage Action Script.
  3. Add an IF Statement.
  4. Add the Is Text requirement to the IF statement:
    • Mode: equals
    • Text:
      {"placeholder":"minecraft_option_value","values":{"name":"pauseOnLostFocus"}}
      
    • Compare With: true
  5. Inside the IF block, add Set Minecraft Option:
    • Option: pauseOnLostFocus
    • Value: false
  6. Add an ELSE Statement.
  7. Inside the ELSE block, add another Set Minecraft Option:
    • Option: pauseOnLostFocus
    • Value: true

The resulting logic is:

IF current option value equals true
    Set option to false
ELSE
    Set option to true

Replace pauseOnLostFocus with the option name you want to toggle.

The option value placeholder reads the current Minecraft setting, while Set Minecraft Option changes it. Boolean options should use true and false as their values. FancyMenu placeholders are JSON-like, so nested placeholders do not need escaped quotes. 🛠️

loud wasp
#

ohh, okay...
now comes the next question, in the way im doing these sub menus... im using custom images for the option's values, one for off and another for on

im doing it like this to font match, so is there a way to have an image change it's source based off these values?

red saffronBOT
# loud wasp ohh, okay... now comes the next question, in the way im doing these sub menus......

Yes. You can use a Switch Case placeholder in the Image element’s resource source.

For example, assuming your option is pauseOnLostFocus:

{"placeholder":"switch_case","values":{"value":"{"placeholder":"minecraft_option_value","values":{"name":"pauseOnLostFocus"}}","cases":"true:/config/fancymenu/assets/pause_on.png,false:/config/fancymenu/assets/pause_off.png","default":"/config/fancymenu/assets/pause_off.png"}}

Setup

  1. Put both images in:
    /config/fancymenu/assets/
    
  2. Right-click the Image element and open its source settings.
  3. Set the source type to Local.
  4. Use Open in Editor for the source field.
  5. Paste the placeholder above.
  6. Replace:
    • pauseOnLostFocus with your option name
    • pause_on.png with your enabled image
    • pause_off.png with your disabled image

The placeholder checks whether the option returns true or false and selects the corresponding image.

FancyMenu placeholders are JSON-like, so the nested placeholder should not have its quotes escaped. Resource sources support placeholders and should update when the value changes. 🖼️

If the image does not refresh immediately after clicking your toggle button, add an Update Screen action after changing the option.

loud wasp
#

thats awesome! thisll help get me through most of these sub menus! i very much appericate it!

red saffronBOT
#

✅ | Custom buttons mapped to boolean values