Weird bug with slider and math

what is happening is when i have a slider value for 1 through 100 i take the value floor it to get rid of the decimal point the i have an append where it has 0. then the value then multiplying 1920 and 1080 separately and getting weird values and if anybody can help me figure out how to take blueprint screenshots i can show it

Hey connormurry-

I’m investigating your issue and want to make sure I understand correctly. You have a slider value (lets say 89.7453) and take the floor (89). Then that gets multiplied by 1920 and 1080 but the results are inaccurate? Please let me know if my understanding of the problem is wrong.

For taking a screenshot, if you hold Alt and press the Print Screen button on your keyboard it will take a picture of just the window that currently has focus. You can then open a program like MS Paint or Photoshop to past the image and save.

well its like what i have here

so as you can see its nothing wrong with the blueprint but im pretty confident in my visual scripting abilities

just fyi this was in the editor

this was when the game was full screened

Hey connormurry-

Rather than multiplying by a static number (such as 1920 or 1080) you are multiplying by the actual viewport size. If the size of the viewport changes it would also change these numbers. So the difference between fullscreen and in editor would be expected. If you change the size of your editor viewport and ran it you would again see different numbers. Connecting a print node after the BreakVector2D will let you see what the resolution of the current viewport is.

Cheers

uh this is not helping me at all i dont want to print out the actual viewport or resolution of the monitor im trying to print out the resolution of the screen divided by the resolution scale to get for say if it was at 50% of 1080p it would be 960 * 540

and i also dont think you get it when the slider is at 100% the resolution output is missing the last number such as instead of showing 1920 * 1080 it does this 192 * 108

How is value being into the event to begin? If it is being stored as an integer you should be able to take the Value/100 to get a decimal form of the value (50% = .5). Then multiply that by the X and Y of your GetViewportSize node. With that you should get the correct ratio without needing the floor or Append nodes.

well the thing is i am using a slider which i have to floor to get rid of the decimal point it produces

To get rid of the decimal from the slider’s percent value you would want to floor it before using it. Doing the floor after your calculations will cause greater rounding error.

OH! i see i didnt realize that im implementing it now but i doubt it will fix the original problem

If Value is being passed in as a number (50% = Value of 50 after the floor) then you only need to divide by 100 to turn that into a decimal and multiply by the viewport size. This result will change based on the size of the viewport being used (fullscreened at 1920x1080 will give a different result than a 1024x768 window).