Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1020

Help: Rainmeter Skins • Re: need to reduce the number of digits

$
0
0
hi everyone
there is a skin showing NetworkMetter
i edited its dimensions, now i need to reduce the number of digits
here is 330.950, reduce it to 330.9, so that after the dot it shows only one value
for example, 0.0 or 00.0 or 000.0

Image

ps, I, as a self-taught person, do not have such knowledge, if you correct this problem I will be very grateful

original:
https://www.deviantart.com/iamanai/art/illustro-Gadgets-1-0-0-576638584
https://forum.rainmeter.net/viewtopic.php?f=27&t=21496
Having a fixed number of decimals is not possible in the current form of the code (i.e. without more editing of the said code). This is because the skin is formatting those values in a way where the total number of digits, both integer and dedimals (aka 'precision') is the priority, to make sure numbers fit nicely on the same amount of space one below the other, even if left aligned. You can read about that in the script by SilverAzide that does the formatting, located in the C:\Users\[User]\Documents\Rainmeter\Skins\illustro Gadgets\@Resources\Scripts\FixedPrecisionFormat.lua file.

Having said that, you can still reduce the amount of digits in a limited fashion, by adjusting, in the ...\illustro Gadgets\Network Meter\Network Meter.ini file, the 2nd parameter of the FormatNumber(...) function occurrences to something like 5 (basically the ones where the said parameter is 6). The reason why it should be 5 and not 4 like you'd expect given that 330.9 has just 4 digits overall, is that multiples of bytes are based on the powers of 2, which means that a MB is not 1000 KB, but 1024 KB, so the maximum number of integer digits will not be 3 (as in from 0 to 999), but 4 (as in from 0 to 1023) - to which, of course, the one desired decimal is added to make a total number of digits of 5.

Other than that, if you really want a fixed number of digits and still want a nice display of them one below another, more changes would be required in Network Meter.ini, like changing the alignment in [StyleText] to Right, adjusting the X coordinates of the last String meters in the file according to the right alignment, giving up on using the FormatNumber(...) functions and just set the corresponding variables to the measure value with the desired number of decimals or to the rounded value of the measure, etc. Alternatively, the FixedPrecisionFormat.lua script could be changed instead, to use a fixed number of decimals, but that would still keep the left alignment in numbers thus the position of the decimal point will not be the same between the number above compared to the number below. In other words, it's more complicated.

Up to you how you want to approach this...

Statistics: Posted by Yincognito — Today, 8:52 pm



Viewing all articles
Browse latest Browse all 1020

Trending Articles