#✅ [SOLVED] ✅ [SOLVED] Slider to change master volume
1 messages · Page 1 of 1 (latest)
Hello Hikinata! 👋
To display the current master volume in-game, you'll want to use the minecraft_option_value placeholder. You can specifically target the master volume by setting its name value to soundCategory_master.
Here's how it would look:
{"placeholder":"minecraft_option_value","values":{"name":"soundCategory_master"}}
This placeholder will return a decimal value between 0.0 and 1.0. If you'd like to display it as a percentage, you can nest this within a calc placeholder! For example:
{"placeholder":"calc","values":{"expression":"({"placeholder":"minecraft_option_value","values":{"name":"soundCategory_master"}}) * 100","decimal":"false"}}%
You can find more information about working with Minecraft options and available placeholders in the documentation:
Let me know if you need any more help! 😊
and action script for $$value?
Hi again! 😊
You're looking to use the $$value placeholder in an action script, especially when linked to a slider!
When you use a Slider element, the $$value placeholder automatically represents the slider's current interactive value. So, if your goal is to change the master volume using a slider, you would set up the "Set Minecraft Option Value" action like this:
- Element: Slider
- Action:
Set Minecraft Option Value - Value for the action:
soundCategory_master:$$value
This tells FancyMenu to update the soundCategory_master (your master volume) with whatever value the slider is currently set to.
Remember to set the slider type to "Decimal Range" with a minimum of 0.0 and a maximum of 1.0 for volume control. And for the slider's initial "Pre-Selected Value," you can set it to {"placeholder":"minecraft_option_value","values":{"name":"soundCategory_master"}} so it starts at the game's current master volume.
You can find more details under the "Setting Options with Sliders" section on the Set/Get Minecraft Options documentation page.
Let me know if that helps!
And to hide or shown chat ? what is the value with checkbox ?
That's a great question! 😊 To hide or show the chat using a checkbox, you'll want to edit a Minecraft configuration option.
The Minecraft option for chat visibility is chatVisibility. It accepts values like 0, 1, or 2 for different visibility states. When using a checkbox, you'd typically toggle between two of these. For example, 0 usually means hidden, and 1 means shown.
Since a Checkbox element toggles between true and false when its state changes, you'll need to use an IF statement in its action script to map these boolean states to the numeric values 0 and 1.
Here’s how you can set it up:
- Add a Checkbox element to your layout.
- Right-click the Checkbox and select Edit Action Script.
- Add an
IFstatement:- Set the condition for the
IFstatement toIs Variable Value(or simply check the checkbox's state). If you use a variable to track the checkbox state (recommended for more complex logic), let's saymy_chat_visibility_var, you'd checkmy_chat_visibility_var == true. - Inside the
IFblock (if true/checked):- Add the
Edit Minecraft Optionaction. - Set the value to
chatVisibility:1(to show chat). - You'd also want to
set_variablemy_chat_visibility_vartofalsefor the next toggle.
- Add the
- Add an
ELSEstatement:- Inside the
ELSEblock (if false/unchecked):- Add the
Edit Minecraft Optionaction. - Set the value to
chatVisibility:0(to hide chat). - You'd also want to
set_variablemy_chat_visibility_vartotruefor the next toggle.
- Add the
- Inside the
- Set the condition for the
This setup ensures that clicking the checkbox toggles the chatVisibility Minecraft option between showing and hiding the chat.
For more details on editing Minecraft options, you can check the Set/Get Minecraft Options documentation. And for using action scripts with conditional statements like "IF," the Action Scripts page can provide more insights! 😊
À solution to reset position by défauts of dragger with button ?
Hi there! To reset the position of a Dragger element back to its default with a button, you can use the Set Variable action in the button's action script.
First, you need to know how the Dragger element saves its position. Draggers store their custom position by setting a dedicated variable. By default, this variable is named fancymenu_dragger_x_position_<element_id> and fancymenu_dragger_y_position_<element_id>. The <element_id> part is the unique identifier of your Dragger element.
Here's how you can set it up:
-
Get your Dragger Element's ID:
- In the layout editor, right-click your Dragger element.
- Select Copy Element Identifier. This will copy its ID to your clipboard. Let's assume it's something like
my_dragger_01.
-
Create a Button:
- Add a new Button element to your layout and give it a label like "Reset Dragger Position".
-
Edit the Button's Action Script:
- Right-click the button.
- Select Edit Action Script.
- Click Add Action.
- Choose the Set Variable action.
-
Set the Variable Values to Reset:
- The
Set Variableaction value isvariable_name:variable_value. - For the X position, you'll want to set it to
0(or your desired default X position). So, the value would be:
fancymenu_dragger_x_position_my_dragger_01:0(replacemy_dragger_01with your actual Dragger ID). - Add another Set Variable action for the Y position, setting its value to:
fancymenu_dragger_y_position_my_dragger_01:0(again, replacemy_dragger_01).
- The
By setting these two variables back to 0 (or whatever coordinates your Dragger is at by default in your layout), the Dragger element will return to its original spot after the button is clicked! ✨
Remember that the Dragger element is designed to save its position persistently. By explicitly setting these variables with the button action, you're overriding the saved custom position.
You can learn more about Dragger elements on the Dragger documentation page, and more about setting variables on the Variables page!
Yes it's that i want but i have make button with this action but do nothing ( where 0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198 is ID of dragger)
Fancymenu_dragger_y_position_0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198:0
Fancymenu_dragger_x_position_0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198:0
Ah, I see! It sounds like you've correctly identified the variable names for your Dragger element's positions.
If the button action isn't doing anything, there are a few possibilities we can check:
-
Variable Name Accuracy: Could there be any typos in the variable names? Double-check that
Fancymenuis spelled exactly asfancymenu(lowercase 'f'). Variable names are usually case-sensitive.- Correct:
fancymenu_dragger_x_position_0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198:0 - Incorrect (if case-sensitive):
Fancymenu_dragger_x_position_0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198:0
- Correct:
-
Element ID: Did you copy the Dragger element's ID directly using the "Copy Element Identifier" option? It's the most reliable way to get the exact ID.
-
Action Execution: Is the button itself working and are other actions configured for it (if any) executing correctly? Sometimes, an issue with the button itself or the conditions under which its actions run can prevent the
Set Variableactions from firing. -
Save and Reload: After making changes to the button's action script, did you save the layout (Ctrl+S or Layout -> Save) and then either leave and re-enter the menu, or use "Reload FancyMenu" (Ctrl+Alt+R or Customization -> Reload FancyMenu)? Sometimes changes don't apply immediately until a reload.
Could you please double-check these points, especially the case-sensitivity of the variable name? Let me know if that helps! 😊
no, i have change Fancy to "fancy" and i have copy the dragger ID with copy element id
Thank you for confirming, Hikinata! It's good to know fancymenu is all lowercase and the ID was directly copied. That eliminates some common pitfalls!
Since the variables aren't being set as expected, even though the configuration seems correct, perhaps there's a subtle interaction or an issue that's not immediately obvious.
It would be super helpful if you could tell me:
- What are you seeing when you click the button? Does anything happen at all? Is there any visual feedback, or does it just seem to do nothing?
- What version of FancyMenu are you currently using? (e.g., 3.5.2)
- What Minecraft version are you playing on? (e.g., 1.20.1)
In the meantime, could you also try verifying if the button's action script is running at all? You could test this by adding a very simple action to the beginning of the script, like a "Send Chat Message/Command" action with a simple message like "Debug: Button Pressed!". If that message appears in chat when you click the button, then we know the script is activating, and the issue is specifically with the variable setting. If not, then the button's actions aren't even firing.
Let me know what you find! We'll figure this out together! 😊
can you can get code to make test with "button" and no dragger
Ah, I understand! You'd like to test if the Set Variable action works in general, using a simple button and your variables, without involving the Dragger element yet. That's a good troubleshooting step!
Let's try creating a test button that sets a generic variable.
-
Create a new test variable:
- Go to Customization -> Variables -> Manage Variables.
- Click Add Variable.
- Name it something simple like
test_variable. You can leave its value empty for now.
-
Create a test button:
- Add a new Button element to your layout.
- Set its label to "Set Test Variable".
-
Edit the test button's Action Script:
- Right-click the new button.
- Select Edit Action Script.
- Click Add Action.
- Choose the Set Variable action.
- For the value, enter:
test_variable:Hello World!
-
Add a way to display the variable (optional but helpful for testing):
- Add a Text element to your layout.
- For its content, use the
Get Stored Variableplaceholder:{"placeholder":"getvariable","values":{"name":"test_variable"}}
-
Save your layout (Ctrl+S or Layout -> Save).
-
Reload FancyMenu (Ctrl+Alt+R or Customization -> Reload FancyMenu).
Now, open the layout where you placed these elements. When you click the "Set Test Variable" button, the text element should update to display "Hello World!". If this works, then the Set Variable action itself is functioning correctly, and we can narrow down the issue to something specific about the Dragger elements or their position variables.
Let me know how this test goes! 😊
To reset x/y possiton to button with button
Ah, you want to reset the X/Y position of another button using a different button! That's a clever way to test if the variable setting is working as expected for positions.
Here's how you can set that up:
First, remember that each element (including buttons) has unique x_pos and y_pos variables that FancyMenu uses. The names for these variables are usually structured like fancymenu_element_x_position_<element_id> and fancymenu_element_y_position_<element_id>.
Let's say you have two buttons:
button_to_move_id(this is the button you want to reset the position of)reset_button_id(this is the button that will reset the first button's position)
Here are the steps:
-
Get the ID of the "Button to Move":
- In the layout editor, right-click on the button whose position you want to reset.
- Click Copy Element Identifier. Let's assume you get
your_button_id_here.
-
Create the "Reset" Button:
- Add a new Button element to your layout.
- Set its label to something like "Reset Button Position".
-
Edit the "Reset" Button's Action Script:
-
Right-click the "Reset Button".
-
Select Edit Action Script.
-
Click Add Action.
-
Choose the Set Variable action.
-
For the value of the action (this will set the X position), enter:
fancymenu_element_x_position_your_button_id_here:0
(Replaceyour_button_id_herewith the actual ID you copied in step 1, and0with the default X position you want it to go to.) -
Click Add Action again.
-
Choose the Set Variable action.
-
For the value of the action (this will set the Y position), enter:
fancymenu_element_y_position_your_button_id_here:0
(Replaceyour_button_id_herewith the actual ID, and0with your desired default Y position.)
-
Now, when you click the "Reset Button Position" button, the your_button_id_here button should jump back to the X:0, Y:0 coordinate (or whatever default values you set).
Remember to save your layout and reload FancyMenu after making these changes! 😊 This test will definitely help us confirm if the core "set position by variable" functionality is working.
you have source too show me this for fancymenu_element_y_position_
You're asking for documentation that explicitly shows fancymenu_element_y_position_ as a variable used by FancyMenu.
Unfortunately, the public documentation doesn't explicitly list these internal variables in detail. The documentation focuses on how to use placeholders like elementposx and elementposy to retrieve an element's position, and actions like "Set Variable" to set variables. It doesn't typically expose the exact naming convention of every internal variable FancyMenu uses to store element properties like position.
However, the logic I provided for fancymenu_element_x_position_<element_id> and fancymenu_element_y_position_<element_id> is based on how FancyMenu handles dynamic positioning and sizing, especially when using advanced features or when elements have their position changed through interaction (like dragging). When you drag an element, FancyMenu implicitly updates such variables internally.
The key points from the documentation that support this approach are:
- Variables: The Variables page explains that variables can store text content and be used for interactive elements.
- Placeholders for Element Position/Size: The Placeholders documentation, specifically
elementposxandelementposy, shows that FancyMenu tracks these positions. While these are placeholders to get the value, the analogous "set variable" action targets the internal variable. - Dragger Element: The Dragger documentation confirms that "The position offset of Dragger elements is persistent and gets saved across game restarts, which basically just means that when a user moves the Dragger, it stays at this "custom" position, even when restarting the game." This persistence implies an internal variable is being saved.
While there isn't a direct "table of all internal element variables" in the public docs, the method of setting fancymenu_element_x_position_<element_id> and fancymenu_element_y_position_<element_id> (or fancymenu_dragger_... for a Dragger) via the Set Variable action is the correct way to programmatically adjust an element's position on interaction.
Let me know if the button-to-button test works for you! That will be a practical confirmation. 😊
fancymenu_element_x_position_<element_id>, we need to replace "element" by button or dragger or we must be always "element"
That's a very good clarifying question!
You should always use "element" in fancymenu_element_x_position_<element_id>.
The word "element" in that variable name acts as a generic identifier for any element whose position is being managed. It doesn't get replaced with "button," "dragger," or any other specific element type. The specific element is identified solely by the <element_id> part.
So, if your Dragger's ID is 0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198, the correct variable names for its X and Y positions are:
- X Position:
fancymenu_element_x_position_0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198 - Y Position:
fancymenu_element_y_position_0c48157a-4e40-497b-8842-155a5e2b7546-1760049861198
And if you were setting the position of a Button named my_cool_button, its X position variable would be:
- X Position:
fancymenu_element_x_position_my_cool_button
The fancymenu_dragger_x_position_ and fancymenu_dragger_y_position_ variables I mentioned earlier are specifically used when the Dragger element is actively being dragged or when its special persistent position is being read. For force-setting its internal position as an element, you would indeed use the fancymenu_element_x_position_ format.
I hope this clarifies things! 😊
If my button element ID is : 1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111
I need to make button with edit script action " set variable value" with this
fancymenu_element_x_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111:0
to put x to 0 ?
Yes, that's absolutely correct! 🎯
If your button's element ID is 1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111, and you want to set its X position to 0 using a Set Variable action, the value you should use is exactly:
fancymenu_element_x_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111:0
You would do the same for the Y position if you want to control that as well!
This should work for moving that specific button. Remember to save your layout and reload FancyMenu after setting up these actions. Let me know how it goes! ✨
not work
Oh dear, I'm sorry to hear it's still not working! It can be a bit tricky when things don't behave as expected. 😥
Since the Set Variable action with the explicit fancymenu_element_x_position_ format isn't directly updating the element's position, we need to gather a bit more information to understand what might be happening.
Could you please provide the following details?
- A Screenshot of Your "Set Variable" Action: A picture of how you've set up the
Set Variableaction in the button's action script would be super helpful. I want to see the variable name and the value you've entered. - What happens when you click the "Reset" button? Does anything change visually on the screen, or does the target button simply remain in its original position?
- What's the full action script of your "Reset" button? Are there any other actions or IF/ELSE statements that might prevent the
Set Variableactions from running? - Are you saving the layout and reloading FancyMenu after every change? Sometimes this step gets missed.
It's possible that for directly manipulable elements (like buttons, images, etc.) which might have some internal positioning logic, directly setting these specific variables might not always override immediately without a screen reinitialization, or the element might need to be explicitly set to "Advanced Positioning" mode.
We'll get to the bottom of this! Don't worry. ✨
I see the screenshot, thank you so much for sharing! It really helps to visualize what you've set up.
From your screenshot, I can see that your action script is set up perfectly with:
fancymenu_element_x_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111:100fancymenu_element_y_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111:0
This looks correct for setting variables via an action script!
However, directly modifying an element's internal position variables (fancymenu_element_x_position_ and fancymenu_element_y_position_) does not automatically update its actual on-screen position dynamically. Those variables are primarily used internally by FancyMenu for some functions, but the element itself doesn't "listen" for changes to them to redraw its position.
To make an element's position dynamic and respond to variable changes, you need to use Advanced Positioning and incorporate placeholders that reference those variables.
Here’s what you need to do:
- For the target button (the one you want to move):
- Right-click it in the layout editor.
- Go to Advanced Positioning.
- For the X Position, enter the placeholder:
{"placeholder":"getvariable","values":{"name":"fancymenu_element_x_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111"}} - For the Y Position, enter the placeholder:
{"placeholder":"getvariable","values":{"name":"fancymenu_element_y_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111"}} - Make sure the
getvariableplaceholder'snamevalue exactly matches the variable names you are setting in your button's action script.
- Initialize the variables: You'll also need to make sure these variables have initial values. You can do this by:
- Going to Customization -> Variables -> Manage Variables.
- Adding
fancymenu_element_x_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111with a beginning value (e.g.,100). - Adding
fancymenu_element_y_position_1bba4cec-89fc-428c-a449-83fc4c7297ce-1760220675111with a beginning value (e.g.,0).
What we're doing here is:
- Your "Reset" button sets the values of those position variables.
- The target button's Advanced Positioning uses placeholders to read those variable values and updates its position accordingly.
This is a powerful technique for creating dynamic, interactive elements! For more information, please check out the Advanced Positioning & Sizing and Variables documentation pages.
Let me know if this helps the button actually move! 😊
but if the screen is not the same size, what happen ? becasue on screen 1920x1080 button ils ont x =200 but on 4096x2048 x= 800
That's a very insightful question about screen scaling! You're absolutely right to consider how different screen sizes affect element positions.
If you set an element's position with a fixed number (like 100 for X and 0 for Y) directly, that number represents a static pixel coordinate. This means:
- On a smaller screen (e.g., 1920x1080),
x=100might place your button far to the left. - On a larger screen (e.g., 4096x2048),
x=100would still place it at 100 pixels from the left, which might appear relatively much closer to the edge or off-center compared to the smaller screen.
This is where FancyMenu's Placeholders become incredibly powerful for Responsive Design!
Instead of setting position variables to static numbers (like 0 or 100), you should use Calculator (calc) placeholders in combination with GUI-related placeholders to make the positions relative to the screen size.
Here’s how you can make your "reset" position dynamic:
Let's assume your "default" position means "centered horizontally" and "at the top edge vertically" (or some other logical position that scales).
1. Update the "Set Variable" actions in your "Reset" button:
Instead of fancymenu_element_x_position_ID:100, you'd use a calc placeholder to set a relative position.
-
To set X to the center of the screen:
fancymenu_element_x_position_ID:{"placeholder":"calc","values":{"expression":"{"placeholder":"guiwidth"} / 2","decimal":"false"}}
This calculates half of the screen's current width. -
To set Y to a specific percentage down the screen (e.g., 10% from the top):
fancymenu_element_y_position_ID:{"placeholder":"calc","values":{"expression":"{"placeholder":"guiheight"} * 0.1","decimal":"false"}}
This calculates 10% of the screen's current height.
If you want the element to be perfectly centered, you'd also need to subtract half of its own width/height from those calculations using elementwidth and elementheight placeholders for extra precision, but dividing the screen width/height by two is often a good starting point for center-aligned elements that use a central anchor.
2. Ensure the target button uses Advanced Positioning with placeholders:
- For the button you want to move, its X and Y position settings in Advanced Positioning should already be set like this:
- X:
{"placeholder":"getvariable","values":{"name":"fancymenu_element_x_position_your_button_id"}} - Y:
{"placeholder":"getvariable","values":{"name":"fancymenu_element_y_position_your_button_id"}}
- X:
Key Concepts from the Documentation:
- Advanced Positioning & Sizing: This page specifically mentions using
CalculatorandGUIcategory placeholders (likeScreen WidthandGUI Scale) to calculate positions and sizes, ensuring reactivity to screen changes. - Placeholders: This covers the
calc,guiwidth, andguiheightplaceholders in detail.
By doing this, your "reset" button won't just move the target to fixed coordinates, but to a position that intelligently adjusts based on the current screen size! ✨
And if i want the button be at the middle right on with how i can do thatr
That's a fantastic question for responsive design! To place a button at the middle-right of the screen and make it adapt to different screen sizes, you'll want to use a combination of placeholders for its Advanced Positioning.
Let's assume your button has an ID like my_right_aligned_button_id.
First, you'll need to set the button to use Advanced Positioning.
Right-click your button in the layout editor:
- Select Advanced Positioning.
- Make sure both
X PositionandY Positionare enabled (they will automatically enable when you enter values).
Now, for the values:
X Position (Middle Right)
To place the button at the middle-right, you'll calculate its X-coordinate based on the screen's width AND its own width. This way, if the screen gets wider, the button moves with it, always staying a fixed distance from the right edge.
{"placeholder":"calc","values":{"expression":"{"placeholder":"guiwidth"} - {"placeholder":"elementwidth","values":{"id":"my_right_aligned_button_id"}} - 10","decimal":"false"}}
Let's break this down:
{"placeholder":"guiwidth"}: This gets the current width of the game window.{"placeholder":"elementwidth","values":{"id":"my_right_aligned_button_id"}}: This gets the current width of your specific button.- 10: This is an offset. It means the button will be 10 pixels away from the right edge of the screen. You can change10to any padding you prefer."decimal":"false": We want whole pixel numbers.
Y Position (Vertical Center)
To vertically center the button, you'll calculate its Y-coordinate based on the screen's height AND its own height.
{"placeholder":"calc","values":{"expression":"({"placeholder":"guiheight"} / 2) - ({"placeholder":"elementheight","values":{"id":"my_right_aligned_button_id"}} / 2)","decimal":"false"}}
Breaking this down:
({"placeholder":"guiheight"} / 2): This finds the exact vertical center of the screen.({"placeholder":"elementheight","values":{"id":"my_right_aligned_button_id"}} / 2): This finds half of your button's height.- By subtracting half the button's height from the screen's center, you ensure the button's own center aligns with the screen's center, effectively centering it vertically.
"decimal":"false": Again, whole pixel numbers.
Important Reminders:
- Replace
my_right_aligned_button_id: Make sure to replace this placeholder ID with the actual element ID of your button. - Save and Reload: Always save your layout and reload FancyMenu (Ctrl+Alt+R) to see the changes.
- Default Anchor Point: While using advanced positioning, the anchor point you've selected for the element might not be as critical, but it's often good practice to ensure it's not set to an arbitrary auto-calculated one. Setting it to "Center of Screen" or a similar central point while using these calculations can help maintain consistency if any part of the advanced positioning fails.
This setup ensures that no matter how the player resizes their Minecraft window, your button will always maintain its position relative to the middle-right of the screen! ✨
You can find more detailed information and examples in the documentation for Advanced Positioning & Sizing and Placeholders.
but if my element is the dragger with text inside, is good to ? juste change advance positionning of dragger ?
Yes, that's a perfectly good approach! If your main interactive element is a Dragger with a Text element inside it (acting as its "body" or label), then you should apply this Advanced Positioning directly to the Dragger element itself.
Here's why and how:
- Dragger as the "Parent": The Dragger element is the one that's designed to be interactively moved and whose position is inherently dynamic. When you anchor other elements (like your Text element) to the Dragger, they will automatically follow the Dragger's position.
- Applying positioning directly to Dragger: By applying the
X PositionandY Positioncalculations (usingguiwidth,guiheight, and the Dragger's ownelementwidth/elementheight) directly to the Dragger element itself, you ensure the entire group (Dragger + attached Text) maintains that responsive "middle-right" position.
Steps:
-
Get the Dragger's Element ID: Right-click on your Dragger element and select "Copy Element Identifier." Let's call it
my_dragger_element_idfor this example. -
Apply Advanced Positioning to the Dragger:
- Right-click on your Dragger element in the layout editor.
- Select Advanced Positioning.
- For the X Position, enter:
{"placeholder":"calc","values":{"expression":"{"placeholder":"guiwidth"} - {"placeholder":"elementwidth","values":{"id":"my_dragger_element_id"}} - 10","decimal":"false"}} - For the Y Position, enter:
{"placeholder":"calc","values":{"expression":"({"placeholder":"guiheight"} / 2) - ({"placeholder":"elementheight","values":{"id":"my_dragger_element_id"}} / 2)","decimal":"false"}} - Remember to replace
my_dragger_element_idwith your actual Dragger's ID in both calculations. - Adjust the
- 10(padding from the right) as needed.
- Ensure your Text element is anchored to the Dragger:
- When you drag the Text element onto the Dragger element, it should automatically anchor. You can also explicitly set the Text element's anchor point to "Parent" (and then select the Dragger as the parent). This ensures the Text moves with the Dragger.
With this setup, the Dragger element will appear at the middle-right of the screen (and stay there responsively), and your Text element will stay positioned relative to the Dragger. If a user drags the Dragger, its position will then be controlled by the user's interaction until reset or reloaded.
You can find more helpful information on the Advanced Positioning & Sizing page and the Dragger page. 😊
witdh of dragger is 80 and 25 to height
Okay, that's useful information! Since you know the width (80) and height (25) of your Dragger, you can simplify the placeholder calculations a bit if those dimensions are static.
However, it's generally best practice to still use the elementwidth and elementheight placeholders for the Dragger's own dimensions within the calculations. This makes your layout more robust. If you ever change the Dragger's size (e.g., to 90 width and 30 height), the calculation will still be correct without you having to manually update the numbers in the positioning formulas.
So, the formulas would remain the same as explained before, but to be clear, here they are with the my_dragger_element_id placeholder for its own dimensions:
X Position (Middle Right) for Dragger (80 width):
{"placeholder":"calc","values":{"expression":"{"placeholder":"guiwidth"} - {"placeholder":"elementwidth","values":{"id":"my_dragger_element_id"}} - 10","decimal":"false"}}
This will automatically use the Dragger's current width (which is 80) in the calculation:
Screen_Width - 80 - 10
Y Position (Vertical Center) for Dragger (25 height):
{"placeholder":"calc","values":{"expression":"({"placeholder":"guiheight"} / 2) - ({"placeholder":"elementheight","values":{"id":"my_dragger_element_id"}} / 2)","decimal":"false"}}
This will automatically use the Dragger's current height (which is 25) in the calculation:
(Screen_Height / 2) - (25 / 2)
Why elementwidth / elementheight is better even if you know the size:
- Future-Proofing: If you later decide to resize your dragger to be 100 pixels wide instead of 80, the position formula will automatically adjust, saving you time.
- Consistency: It ensures the calculation always uses the actual rendered size of the element, even if you typed a number in the wrong place by mistake.
Remember to replace my_dragger_element_id with your Dragger's actual identifier in these placeholder expressions! 😊
but if player move dragger , advance positionning will prevent the user from saving the position
You've hit on a critical point and a very common misconception! 🎯 You are absolutely correct to be concerned about that.
You are right! If a Dragger element has Advanced Positioning applied with dynamic placeholders that calculate its position, the user will not be able to save its moved position. The Dragger will always snap back to the calculated position when the screen reloads because the Advanced Positioning calculation overrides any manually set position.
This means for a Dragger with a dynamic default position that you still want the user to be able to move and save, you CANNOT use Advanced Positioning on the Dragger itself.
My apologies if my previous responses led you down the wrong path for this specific use case! We need a different approach.
The Correct Approach: Initialize the Position (and use a Reset Button)
Instead of forcing the Dragger's position with Advanced Positioning, you should:
-
Remove Advanced Positioning from the Dragger. The Dragger should use its default positioning, which allows users to move it and save its position.
-
Initialize the Dragger's Position: Use a Ticker element that runs Once on Load Screen to set the Dragger's X and Y position variables only if they haven't been set by the user yet. This allows you to give it a responsive default position without preventing the user from saving a custom one.
-
Implement your Reset Button (as discussed): This button would set those same Dragger variables back to their calculated responsive defaults.
Let's refine the solution:
Step 1: Dragger Element Setup
- Remove any Advanced Positioning from your Dragger element.
- Ensure your text element is anchored to the Dragger.
Step 2: Create an "Initialize Position" Ticker (Runs Once)
This ticker will check if the Dragger has a saved custom position. If not, it sets it to your responsive default.
- Add a new Ticker element to your layout.
- Right-click the Ticker and go to Tick Settings.
- Set Tick Mode to
Once (after screen loads). - Set Tick Delay to something small, like
10ms (or default).
- Set Tick Mode to
- Right-click the Ticker and select Edit Action Script.
- Add an IF Statement:
- Condition: Use the
Is Variable Valuerequirement. - Variable Name:
fancymenu_element_x_position_my_dragger_element_id(Replace ID). - Expected Value: Set this to empty (leave it blank, it will check if the variable currently has no value).
- Requirement Mode:
None(so it checks if the variable is blank/not yet set).
- Condition: Use the
- Inside this IF block, add two Set Variable actions to set your responsive default position:
fancymenu_element_x_position_my_dragger_element_id:{"placeholder":"calc","values":{"expression":"{"placeholder":"guiwidth"} - {"placeholder":"elementwidth","values":{"id":"my_dragger_element_id"}} - 10","decimal":"false"}}fancymenu_element_y_position_my_dragger_element_id:{"placeholder":"calc","values":{"expression":"({"placeholder":"guiheight"} / 2) - ({"placeholder":"elementheight","values":{"id":"my_dragger_element_id"}} / 2)","decimal":"false"}}
(Remember to replacemy_dragger_element_idwith your Dragger's actual ID in these, and adjust the padding- 10for X).
Step 3: Create your "Reset Position" Button (as previously discussed)
This button will force the same responsive default calculations into the Dragger's position variables:
- Add a Button element for "Reset Position".
- Right-click the Button and select Edit Action Script.
- Add two Set Variable actions:
fancymenu_element_x_position_my_dragger_element_id:{"placeholder":"calc","values":{"expression":"{"placeholder":"guiwidth"} - {"placeholder":"elementwidth","values":{"id":"my_dragger_element_id"}} - 10","decimal":"false"}}fancymenu_element_y_position_my_dragger_element_id:{"placeholder":"calc","values":{"expression":"({"placeholder":"guiheight"} / 2) - ({"placeholder":"elementheight","values":{"id":"my_dragger_element_id"}} / 2)","decimal":"false"}}
By using this approach:
- When the screen first loads, the Ticker checks if the Dragger has a saved custom position. If not (first load, or user hasn't moved it yet), it uses your responsive default.
- If the user moves the Dragger, its position is saved, and the Ticker's condition for setting defaults won't be met on subsequent loads.
- Your "Reset" button can always bring it back to the responsive default.
This is a much more robust solution for Dragger elements that are both responsive and user-movable! Thanks for catching my oversight; it's why these conversations are so valuable! 😊
This support thread has been marked as solved by @idle gazelle.
The AI helper is now disabled, but you can still continue the conversation if needed. Thank you for using our support system!
✅ [SOLVED] Slider to change master volume
This support thread has been marked as solved by @idle gazelle.
The AI helper is now disabled, but you can still continue the conversation if needed. Thank you for using our support system!
✅ [SOLVED] ✅ [SOLVED] Slider to change master volume