It is currently April 25th, 2024, 8:23 am

2 Digits

Get help with creating, editing & fixing problems with skins
User avatar
sa1nt4ch
Posts: 49
Joined: December 16th, 2020, 8:30 am
Location: Switzerland

2 Digits

Post by sa1nt4ch »

Is there a way to always display 2 digits so it shows

Code: Select all

1.5
for smal numbers and

Code: Select all

13
for numbers bigger 10
User avatar
sa1nt4ch
Posts: 49
Joined: December 16th, 2020, 8:30 am
Location: Switzerland

Re: 2 Digits

Post by sa1nt4ch »

don't bother I think i did it.

Code: Select all

[CalcPhysicalMemoryUsedGB]
Measure=Calc
Formula=MeasurePhysicalMemoryUsed/1000000000
IfCondition=(CalcPhysicalMemoryUsedGB  < 10) 
IfTrueAction=[!SetOption Meter_PhysicalMemoryUsed_Bar_Text Text "[CalcPhysicalMemoryUsedGB:1]"]
IfFalseAction=[!SetOption Meter_PhysicalMemoryUsed_Bar_Text Text "[CalcPhysicalMemoryUsedGB:0]"])
Unless someone has more then 100 GB or ram this should work
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: 2 Digits

Post by balala »

Or another possibility is to display the number as a string (adding a MeasureName=CalcPhysicalMemoryUsedGB option to the String meter which shows the value) and use a NumOfDecimals=2 option on the same String meter. This procedure has the advantage of not requiring to set on the dynamic variables.
User avatar
sa1nt4ch
Posts: 49
Joined: December 16th, 2020, 8:30 am
Location: Switzerland

Re: 2 Digits

Post by sa1nt4ch »

may be my english is limited but I understud decimals always as the digits after the 0.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: 2 Digits

Post by death.crafter »

sa1nt4ch wrote: September 3rd, 2021, 3:17 pm may be my english is limited but I understud decimals always as the digits after the 0.
https://www.cuemath.com/numbers/decimals/
Decimals are a set of numbers written together with a dot in between them that is called a decimal point. The numbers to the left of the decimal point are the integers or whole numbers and the numbers to the right of the decimal point are called decimal numbers.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: 2 Digits

Post by balala »

sa1nt4ch wrote: September 3rd, 2021, 3:17 pm may be my english is limited but I understud decimals always as the digits after the 0.
In fact the decimals are the digits after the decimal separator (or point) (.).
Here is an example. Try playing with the value of the NumOfDecimals option of the [MeterPI] meter:

Code: Select all

[Rainmeter]
Update=1000

[MeasurePI]
Measure=Calc
Formula=3.141592

[MeterPI]
Meter=STRING
MeasureName=MeasurePI
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=PI: %1
NumOfDecimals=2