Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Dialog Slider with 0 decimals still returns decimal values when selected #655

Open
Crowdedlight opened this issue Nov 18, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@Crowdedlight
Copy link
Contributor

Arma 3 Version: 2.06 (stable) **CBA Version:** 3.15.6(stable) **ZEN Version:**1.12.1` (stable)

Mods:

- CBA_A3
- ZEN

Description:
When using the dynamic dialog slider with the option for 0 decimals it can still return decimal numbers below the shown number:

["SLIDER","Detective Count", [0,10,1,0]]

Ingame I can set two different values with the same value shown in text-box. First one where I entered 1, so I know its directly set on 1. The second one I dragged the slider until it said 1. As you can tell the slider position differs between them, but both still show 1. When clicked ok the result passed for the second screenshot is: 0.930346 or some decimal number below 1.

20211118232715_1

It seems like the editbox field correctly gets "rounded" to the nearest number but the value sent when clicking ok, is the raw value that is not rounded. This then causes errors when the value returned is used in for-loops as limits.

Expected behavior:
I expected that when selecting using 0 decimals the value in the field I see is the one that is passed on when clicking "confirm".

Steps to reproduce:
Add the steps needed to reproduce the issue.

  1. Use a dynamic dialog slider with 0 decimal option
  2. drag the slider a bit lower than where it is when it says 1.
  3. See the value it returns being a decimal number instead of integer.

Where did the issue occur?

  • Dedicated / Self-Hosted Multiplayer / Editor - Multiplayer
@Crowdedlight Crowdedlight added the bug Something isn't working label Nov 18, 2021
@mharis001
Copy link
Member

The 4th argument specifies the formatting of the value in the edit box (i.e. it can also accept code for custom formatting). Easiest solution is for the calling code to round the value. We could expand the control type to also support snapping the slider to the nearest "increment" when released but not sure how useful that is.

@Crowdedlight
Copy link
Contributor Author

Crowdedlight commented Nov 19, 2021

Yes, I changed ro use round when I found the issue. And that works fine. It was more based on the description of the slide options, I understood it as the option would "round" the value as the editbox shows. I would at least advice making it a bit more clear on the documentation page, as I ended up having an intermittent bug for quite a while before I realised that was what happened.

Snapping the slider to the decimal increments chosen in the option would make a lot of sense. As most time it seems like people use the slider to drag until the editbox show what they want to choose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants