It is currently April 25th, 2024, 4:51 pm

Smooth Meter Fade In/Out

Discuss the use of Lua in Script measures.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Smooth Meter Fade In/Out

Post by Kaelri »

ElderGoose wrote:Any idea on what would cause this?
What do you have as the "Min" option on the script measure?
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Smooth Meter Fade In/Out

Post by ElderGoose »

My script measure looks like this:

[MeterFade]
Measure=Script
ScriptFile=Fade.lua
MeterName=MyImg1

so it should be set at the default? (zero)
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Smooth Meter Fade In/Out

Post by Kaelri »

Hm, no, it should work fine if the option isn't set. Can you post your whole skin, then? Something else must be interfering with the script somehow. (I'm also assuming you have not modified the script file in any way.)
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Smooth Meter Fade In/Out

Post by ElderGoose »

eheh, it's pretty messy but...

here's a simplified version:

Code: Select all

[Rainmeter]
Update=1

[Variables]
Numb=50
MaxNumber=2000

===================================================================================

[MeterFade1]
Measure=Script
ScriptFile=C:\Users\Ryan\Documents\Rainmeter\Skins\illustro\GrowingTree\Fade.lua
MeterName=MyImg1

===================================================================================

[cCounter1]
Measure=Calc
Formula=(cCounter1+1)%(#MaxNumber#)
IfAboveValue=#Numb#
IfAboveAction=!CommandMeasure "MeterFade1" "Activate()"

[ResetCounter]
Measure=Calc
Formula=(ResetCounter+1)%(#MaxNumber#)
IfEqualValue=(#Numb#+1250)
IfEqualAction=!CommandMeasure "MeterFade1" "Activate()"

====================================================================================

[MyImg]
Meter=Image
ImageName=image.png
ImageTint=255,255,255,255
x=47
y=100
h=200
w=200
DynamicVariables=1

[MyImg1]
Meter=Image
ImageName=image1.png
ImageTint=255,255,255,[MeterFade1]
x=1
y=0
DynamicVariables=1
and here's the full code. but it's not anything new really...just repeating code:

Code: Select all

[Rainmeter]
Update=1

[Variables]
Numb=50
MaxNumber=2000

=======================================================================================

[MeterFade1]
Measure=Script
ScriptFile=Fade.lua
MeterName=MyImg1

[MeterFade2]
Measure=Script
ScriptFile=Fade2.lua
MeterName=MyImg2

[MeterFade3]
Measure=Script
ScriptFile=Fade3.lua
MeterName=MyImg3

[MeterFade4]
Measure=Script
ScriptFile=Fade4.lua
MeterName=MyImg4

[MeterFade5]
Measure=Script
ScriptFile=Fade5.lua
MeterName=MyImg5

======================================================================================

[cCounter1]
Measure=Calc
Formula=(cCounter1+1)%(#MaxNumber#)
IfAboveValue=#Numb#
IfAboveAction=!CommandMeasure "MeterFade1" "Activate()"

[cCounter2]
Measure=Calc
Formula=(cCounter2+1)%(#MaxNumber#)
IfAboveValue=(#Numb#+250)
IfAboveAction=!CommandMeasure "MeterFade2" "Activate()"

[cCounter3]
Measure=Calc
Formula=(cCounter3+1)%(#MaxNumber#)
IfAboveValue=(#Numb#+500)
IfAboveAction=!CommandMeasure "MeterFade3" "Activate()"

[cCounter4]
Measure=Calc
Formula=(cCounter4+1)%(#MaxNumber#)
IfAboveValue=(#Numb#+750)
IfAboveAction=!CommandMeasure "MeterFade4" "Activate()"

[cCounter5]
Measure=Calc
Formula=(cCounter5+1)%(#MaxNumber#)
IfAboveValue=(#Numb#+1000)
IfAboveAction=!CommandMeasure "MeterFade5" "Activate()"

[ResetCounter]
Measure=Calc
Formula=(ResetCounter+1)%(#MaxNumber#)
IfEqualValue=(#Numb#+1250)
IfEqualAction=[!CommandMeasure "MeterFade5" "Activate()"][!CommandMeasure "MeterFade4" "Activate()"][!CommandMeasure "MeterFade3" "Activate()"][!CommandMeasure "MeterFade2" "Activate()"][!CommandMeasure "MeterFade1" "Activate()"]

======================================================================================

[MyImg]
Meter=Image
ImageName=image.png
ImageTint=255,255,255,255
x=47
y=100
h=200
w=200
DynamicVariables=1

[MyImg1]
Meter=Image
ImageName=image1.png
ImageTint=255,255,255,[MeterFade1]
x=1
y=0
DynamicVariables=1

[MyImg2]
Meter=Image
ImageName=image2.png
ImageTint=255,255,255,[MeterFade2]
x=0
y=0
DynamicVariables=1

[MyImg3]
Meter=Image
ImageName=image3.png
ImageTint=255,255,255,[MeterFade3]
x=0
y=0
DynamicVariables=1

[MyImg4]
Meter=Image
ImageName=image4.png
ImageTint=255,255,255,[MeterFade4]
x=0
y=0
DynamicVariables=1

[MyImg5]
Meter=Image
ImageName=image5.png
ImageTint=255,255,255,[MeterFade5]
x=0
y=0
DynamicVariables=1
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Smooth Meter Fade In/Out

Post by Kaelri »

I don't get any errors with either version. Are you sure you didn't modify the script in any way? Try replacing it with a fresh copy of the code. You can copy it from the first post of this thread.

(I'm also not sure why you're using extra copies of the script file, e.g. Fade2.lua, Fade3.lua, etc. if you haven't modified them.)
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Smooth Meter Fade In/Out

Post by ElderGoose »

Yeah, I downloaded fresh copies of the lua.
The reason I have multiple fades is because I'm fairly new to Rainmeter and am still figuring everything out...haha
My original thought was that I needed a fade for each image, so that when one counter activates the script and begins to fade in, the other images don't start fading in too.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Smooth Meter Fade In/Out

Post by Kaelri »

You do need separate measures for each meter, but they can all use the same .lua file. :)
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Smooth Meter Fade In/Out

Post by ElderGoose »

Alright cool, that shrinks my code down a little.
However, now I'm getting the error "Script: Fade.lua:10: attempt to call method 'getNumberOption' (a nil value)" as well as the first error.
(this was happening before I got rid of fade2,3,4,5)
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Smooth Meter Fade In/Out

Post by Kaelri »

Can you tell me which version of Rainmeter you're using? (Right-click the Rainmeter tray icon, click "About", then the "Version" tab, then "Copy to Clipboard.")
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Smooth Meter Fade In/Out

Post by ElderGoose »

...
V_V

it's 2.2...
I think I downloaded the new version a couple days ago, and then deleted it instead of the old version...