It is currently April 26th, 2024, 7:30 am

Creating Independent Counters

Tips and Tricks from the Rainmeter Community
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Creating Independent Counters

Post by smurfier »

What you ask is not possible with the math that is used.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Creating Independent Counters

Post by KreAch3R »

smurfier wrote:What you ask is not possible with the math that is used.
Thanks for taking the time. I resorted to Lua instead.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Creating Independent Counters

Post by ElderGoose »

Is there a way to make one counter execute different actions when it reaches different values?
For example: at 5 it executes X, at 10 it executes Y, at 15 it executes Z, etc...

or... some way to combine this into 1 counter:

Code: Select all

[Variables]
Numb=10
MaxNumber=1000

[cCounter1]
Measure=Calc
Formula=cCounter1+1
IfEqualValue=#Numb#
IfEqualAction=!blah1

[cCounter2]
Measure=Calc
Formula=cCounter2+1
IfEqualValue=(#Numb#+250)
IfEqualAction=!blah2

[cCounter3]
Measure=Calc
Formula=cCounter3+1
IfEqualValue=(#Numb#+500)
IfEqualAction=!blah3
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Creating Independent Counters

Post by smurfier »

Could you give me more detail on the actions you wish to execute?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Creating Independent Counters

Post by ElderGoose »

They are going to execute a !bang that activates a script which fades in meters:

Code: Select all

!CommandMeasure "MeterFade1" "Activate()"
!CommandMeasure "MeterFade2" "Activate()"
!CommandMeasure "MeterFade3" "Activate()"

So, my hope is that as one counter counts up, different images are faded in via the script:

Code: Select all

[MeterFade1]
Measure=Script
ScriptFile=Fade.lua
MeterName= Img1
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Creating Independent Counters

Post by smurfier »

This should work:

Code: Select all

[cCounter]
Measure=Calc
Formula=cCounter%500+1

[MeasureNumber]
Measure=Calc
Formula=CEIL(cCounter/250)

[Action]
Measure=Calc
Formula=cCounter%250
IfEqualValue=0
IfEqualAction=!CommandMeasure "MeterFade[MeasureNumber]" "Activate()"
DynamicVariables=1

[MeterFade1]
Measure=Script
ScriptFile=Fade.lua

[MeterFade2]
Measure=Script
ScriptFile=Fade.lua

[MeterFade3]
Measure=Script
ScriptFile=Fade.lua
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Creating Independent Counters

Post by ElderGoose »

Interesting! I didn't know there was subscripting in Rainmeter. Thanks!
User avatar
TweaknFreak
Posts: 217
Joined: July 14th, 2012, 7:26 am

Re: Creating Independent Counters

Post by TweaknFreak »

Can there be a Counter measure that counts down and resets at a predefined value ?? I tried a lot for the past 4 hrs but in vain. Since the count down measure code is already bit complicated may be that's why I'm unable to do it. Can anyone do it please ?

BTW, I'm not that good in maths too.
Be one of the iNEViTABLES - Storm, Earthquake, Lightning, Flood - and the world will bow down to you.

My current desktop
[hsimg]http://i1313.photobucket.com/albums/t559/TweaknFreak/6-22-20149-46-40PM_zps7bcbc1f6.png[/hsimg]
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Creating Independent Counters

Post by smurfier »

TweaknFreak wrote:Can there be a Counter measure that counts down and resets at a predefined value ?? I tried a lot for the past 4 hrs but in vain. Since the count down measure code is already bit complicated may be that's why I'm unable to do it. Can anyone do it please ?

BTW, I'm not that good in maths too.
Unfortunately it does not appear that what you ask is possible. The reset value for that particular style of counter must be 0.

However, the effect can be accomplished by using two measures.

Code: Select all

[Variables]
Max=5
Reset=3

[cCounter]
Measure=Calc
formula=(cCounter-1+(#Max#-#Reset#+1))%(#Max#-#Reset#+1)

[cCounter2]
Measure=Calc
Formula=cCounter+#Reset#
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
TweaknFreak
Posts: 217
Joined: July 14th, 2012, 7:26 am

Re: Creating Independent Counters

Post by TweaknFreak »

smurfier wrote: Unfortunately it does not appear that what you ask is possible. The reset value for that particular style of counter must be 0.

However, the effect can be accomplished by using two measures.

Code: Select all

[Variables]
Max=5
Reset=3

[cCounter]
Measure=Calc
formula=(cCounter-1+(#Max#-#Reset#+1))%(#Max#-#Reset#+1)

[cCounter2]
Measure=Calc
Formula=cCounter+#Reset#
That was great!!! Thanx. :thumbup:
Be one of the iNEViTABLES - Storm, Earthquake, Lightning, Flood - and the world will bow down to you.

My current desktop
[hsimg]http://i1313.photobucket.com/albums/t559/TweaknFreak/6-22-20149-46-40PM_zps7bcbc1f6.png[/hsimg]