#✅ | Mouse Sensitivity Slider
1 messages · Page 1 of 1 (latest)
Oh, I understand! Creating a custom slider for mouse sensitivity can be a bit tricky because the internal values aren't straightforward. Don't worry, I can help you figure this out! 🐭
The documentation doesn't have specific details on the internal values for mouse sensitivity, but it does say that you can use the "Minecraft Option Value" placeholder. This means you can get and set the mouseSensitivity option.
To set up a custom slider for this, you'll generally follow these steps:
- Add a new Slider element.
- Set the slider type (e.g., Decimal Range).
- Set the minimum and maximum values for the slider. This is where it gets a little tricky with mouse sensitivity, as the direct numerical range might not be obvious from the game's settings.
- Add an action using "Set Minecraft Option Value":
- Set the
NametomouseSensitivity. - Set the
Valueto$$value(this special placeholder will insert the slider's current value).
- Set the
- Set the pre-selected value to the current
mouseSensitivityusing theminecraft_option_valueplaceholder.
Since the actual value range for mouseSensitivity isn't clearly defined in the documentation, I recommend doing a little experiment in-game:
- Set your mouse sensitivity in Minecraft's options to its lowest possible setting, then use the
minecraft_option_valueplaceholder in a temporary Text element to see what value it returns. - Do the same for the highest possible setting.
- Do this for a "normal" setting you prefer.
This will give you a better idea of the Minimum Range Value and Maximum Range Value you should use for your custom slider.
You can learn more about working with Minecraft options in the documentation here:
Set/Get Minecraft Options
Let me know if you need any more guidance after you've experimented with the values! 😊
slowest: "0.0"
fastest: "1.0"
normal (in the middle): "0.5035211267605634"
o_o
Oh, wow, that's quite a specific number for "normal"! 😅 But hey, at least we have the range now: 0.0 to 1.0.
This actually makes setting up your slider much easier! You can use these values directly for your Decimal Range slider.
Here’s how you can set it up:
1. Create a new Slider element.
2. Configure the Slider properties:
- Slider Type:
Decimal Range - Minimum Range Value:
0.0 - Maximum Range Value:
1.0 - Steps: This is optional, but if you want the slider to snap to certain increments (e.g., 0.05), you can set this. If you want it to be smooth like the vanilla slider, you might leave it blank or set it to a very small decimal.
3. Set the action for the slider:
- Right-click the slider in the editor and choose
Edit Action Script. - Click
Add Action. - Select
Edit Minecraft Option. - For
option_name, typemouseSensitivity. - For
set_to_value, type$$value. This will dynamically set the sensitivity to whatever value the slider is currently at.
4. Set the pre-selected value:
- In the slider's right-click options (
Slider Value->Pre-Selected Value), use the placeholder:
```json
{"placeholder":"minecraft_option_value","values":{"name":"mouseSensitivity"}}
```
This will make sure your custom slider starts at your current in-game sensitivity setting.
5. Update the slider's label (optional, but recommended for feedback):
- You can set the slider's label to show the current
mouseSensitivityvalue. For example:
```
Mouse Sensitivity: {"placeholder":"minecraft_option_value","values":{"name":"mouseSensitivity"}}
```
- Since
0.5035...is a bit messy, you could also round it or format it using thecalcplaceholder. For instance, to show it as a percentage up to two decimal places:
```json
Mouse Sensitivity: {"placeholder":"calc","values":{"expression":"({%placeholder":"minecraft_option_value","values":{"name":"mouseSensitivity"%} * 100).toFixed(2)","decimal":"true"}}%
```
(Just make sure to replace the inner `%` with `"` or escape them properly if you use this in the slider label.)
This detailed setup should give you a functional mouse sensitivity slider! Let me know if you run into any other quirks. 😊
everything works besides the text element. if it's in the middle, it shows 0.5
how do I make it show 100? (for 200 if it's on 1.0)
Oh, I see what you're aiming for! You want the slider's display value to represent a percentage or a scaled number, rather than the raw 0.0 to 1.0 range. That's a super common and effective way to make numbers more user-friendly! 😊
You can achieve this using the Calculator placeholder within your Text element or slider label. Based on your values (0.0 for slowest, 1.0 for fastest, and wanting to see 100 when it's 0.5, or 200 when it's 1.0), it seems like you want to multiply the raw value by 200.
Here's how you can do it for your slider label or a Text element:
For the slider's label, or a separate Text element:
{"placeholder":"calc","values":{"expression":"{"placeholder":"minecraft_option_value","values":{"name":"mouseSensitivity"}} * 200","decimal":"false"}}
Let's break this down:
- The outer
{"placeholder":"calc", ...}is calling the Calculator. "expression": "..."is where our math goes.{"placeholder":"minecraft_option_value","values":{"name":"mouseSensitivity"}}will fetch the current rawmouseSensitivityvalue (e.g.,0.5).* 200then multiplies that raw value by 200."decimal":"false"ensures that the result is an integer (no messy decimal places). If you want decimal places (e.g.,100.75), you can set this to"true".
So, if mouseSensitivity is 0.5, the expression becomes 0.5 * 200 = 100.
If mouseSensitivity is 1.0, the expression becomes 1.0 * 200 = 200.
This should give you the scaled number you're looking for! Let me know if that works for you. ✨
yeah this works