It is currently May 3rd, 2024, 12:14 am

.0 with lua ?

Report bugs with the Rainmeter application and suggest features.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

.0 with lua ?

Post by AlC »

Hey Guys,

notice a small (maybe) bug.
I did a small testskin/lua, which get the width of a string. And scale with it a BackgroundImage + ScaleMargins

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Background]
Meter=IMAGE
ImageName=#CurrentPath#TopDate.png
AntiAlias=1
X=0
Y=0
H=67
W=[Calc]
ScaleMargins=15,0,15,0
DynamicVariables=1

[StringMeter]
Meter=String
MeasureName=mWinampRadio
FontColor=255,255,255
X=15
Y=25
FontFace=Comic Sans MS
FontSize=10
AntiAlias=1

[MeasureLua]
Measure=Script
ScriptFile=#CurrentPath#Length.lua

[Calc]
Measure=Calc
Formula=(15*2)+MeasureLua

[mWinampRadio]
Measure=Plugin
Plugin=Plugins\WindowMessagePlugin.dll
WindowClass=Winamp v1.x

Code: Select all

PROPERTIES =
{
}
function Initialize()

end

function Update()
return SKIN:GetMeter("StringMeter"):GetW()
end
So now I get in the about box: Measure - Calc Value - i.E. 242.0

Removed trailing zeros from calculated numbers.
Rainmeter will no longer automatically add zeros to a calculated number to force a constant 5 decimal places. The amount of "precision" will be only that required to support the value, up to 5 decimal places. This will eliminate the need to use Substitute=".00000":"" to strip the unneeded precision off of integer values returned by a Calc and used in other measures or meters as a string.
1.00000 -> 1
1.01000 -> 1.01
1.01001 -> 1.01001
I have 2.1 871. But the backgroundimage accept the 242.0 so maybe it's right :)
Rainmeter - You are only limited by your imagination and creativity.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: .0 with lua ?

Post by Kaelri »

If I'm not mistaken, the Rainmeter "About" window hasn't been updated to reflect the recent changes to trailing zeroes. The actual measure value should be decimal-free, which you could confirm by writing a temporary string meter to display it - or using another little Lua script to get and print the measure value. :)
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: .0 with lua ?

Post by AlC »

Yep, I had an extra string to show the calc measure and it was decimal-free.
I was confused the whole time because of the .0 and I thought this was my problem (W=242.0) all the time and tried to fix it but ...

all things considered I forget DynamicVariables=1 :)
Rainmeter - You are only limited by your imagination and creativity.