It is currently March 28th, 2024, 2:07 pm

Random Calc Activating ActionTimer?

Get help with creating, editing & fixing problems with skins
Post Reply
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am
Contact:

Random Calc Activating ActionTimer?

Post by Krainz »

I have the following code but I'm not able to make the blink/smile images randomly appear as intended:

Code: Select all

[Rainmeter]
Author=Krainz
OnUpdateAction=[!UpdateMeasure MeasureRandomBlinkSmile][!UpdateMeter TestRandomBlink]
MouseActionCursor=Arrow
AccurateText=1
Update=50
DefaultUpdateDivider=8640


[MeasureRandomBlinkSmile]
Measure=Calc
Formula=Random
UpdateRandom=1
MinValue=1
MaxValue=100
OnUpdateAction=[!UpdateMeasure MeasureRandomBlinkCheck]


[MeasureRandomBlinkCheck]
Measure=Calc
Formula=MeasureRandomBlinkSmile
IfCondition=([MeasureRandomBlinkSmile] > 98)
IfTrueAction=[!CommandMeasure Random "Execute 3"]
IfCondition2=(95 < [MeasureRandomBlinkSmile] < 99)
IfTrueAction2=[!CommandMeasure Random "Execute 2"]
IfCondition2=(10 < [MeasureRandomBlinkSmile] < 60)
IfTrueAction2=[!CommandMeasure Random "Execute 1"]


[Random]
Measure=Plugin
Plugin=ActionTimer
ActionList1=ShowBlink | Wait 190 | HideBlink
ActionList2=ShowBlink | Wait 260 | HideBlink
ActionList3=ShowBlink | Wait 260 | ShowSmile | Wait 600 | HideSmile | Wait 220 | HideBlink
ShowBlink=[!ShowMeter RandomBlink]
HideBlink=[!HideMeter RandomBlink]
ShowSmile=[!ShowMeter RandomBlinkSmile]
HideSmile=[!HideMeter RandomBlinkSmile]
DynamicVariables=1

[RandomBlink]
Meter=Image
ImageName=Random-blink.jpg
X=(205)
Y=(227)
DynamicVariables=1
AntiAlias=1
Hidden=1

[RandomBlinkSmile]
Meter=Image
ImageName=Random-blinksmile.jpg
X=(205)
Y=(227)
DynamicVariables=1
AntiAlias=1
Hidden=1

[TestRandomBlink]
Meter=String
FontFace=Arial Black
FontColor=0,0,0
FontSize=14
AntiAlias=1
MeasureName=MeasureRandomBlinkSmile
DynamicVariables=1
X=205
Y=300
What am I doing wrong?
Last edited by Krainz on February 8th, 2020, 6:47 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Random Calc Activating ActionTimer?

Post by jsmorley »

Krainz wrote: February 8th, 2020, 6:43 pm I have the following code but I'm not able to make the blink/smile images randomly appear as intended:

Code: Select all

[Rainmeter]
Author=Krainz
OnUpdateAction=[!UpdateMeasure MeasureRandomBlinkSmile][!UpdateMeter TestRandomBlink]
MouseActionCursor=Arrow
AccurateText=1
Update=50
DefaultUpdateDivider=8640


[MeasureRandomBlinkSmile]
Measure=Calc
Formula=Random
UpdateRandom=1
MinValue=1
MaxValue=100
OnUpdateAction=[!UpdateMeasure MeasureRandomBlinkCheck]


[MeasureRandomBlinkCheck]
Measure=Calc
Formula=MeasureRandomBlinkSmile
IfCondition=([MeasureRandomBlinkSmile] > 98)
IfTrueAction=[!CommandMeasure Random "Execute 3"]
IfCondition2=(95 < [MeasureRandomBlinkSmile] < 99)
IfTrueAction2=[!CommandMeasure Random "Execute 2"]
IfCondition2=(10 < [MeasureRandomBlinkSmile] < 60)
IfTrueAction2=[!CommandMeasure Random "Execute 1"]


[Random]
Measure=Plugin
Plugin=ActionTimer
ActionList1=ShowBlink | Wait 190 | HideBlink
ActionList2=ShowBlink | Wait 260 | HideBlink
ActionList3=ShowBlink | Wait 260 | ShowSmile | Wait 600 | HideSmile | Wait 220 | HideBlink
ShowBlink=[!ShowMeter RandomBlink]
HideBlink=[!HideMeter RandomBlink]
ShowSmile=[!ShowMeter RandomBlinkSmile]
HideSmile=[!HideMeter RandomBlinkSmile]
DynamicVariables=1

[RandomBlink]
Meter=Image
ImageName=Random-blink.jpg
X=(205)
Y=(227)
DynamicVariables=1
AntiAlias=1
Hidden=1

[RandomBlinkSmile]
Meter=Image
ImageName=Random-blinksmile.jpg
X=(205)
Y=(227)
DynamicVariables=1
AntiAlias=1
Hidden=1

[TestRandomBlink]
Meter=String
FontFace=Arial Black
FontColor=0,0,0
FontSize=14
AntiAlias=1
MeasureName=MeasurePikaBlinkSmile
DynamicVariables=1
X=205
Y=300
What am I doing wrong?
Well, to start with, you need DynamicVariables=1 on the measure [MeasureRandomBlinkCheck], as it is using [SectionVariables] in the IfConditions.
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am
Contact:

Re: Random Calc Activating ActionTimer?

Post by Krainz »

Hey thanks, I think that worked!

I kinda always get lost on when to use or not to use DynamicVariables and I'm pretty sure I'm enabling it in many meters without needing. Is there a downside to just putting DynamicVariables=1 in all meters?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Random Calc Activating ActionTimer?

Post by jsmorley »

Krainz wrote: February 8th, 2020, 6:49 pm Hey thanks, I think that worked!

I kinda always get lost on when to use or not to use DynamicVariables and I'm pretty sure I'm enabling it in many meters without needing. Is there a downside to just putting DynamicVariables=1 in all meters?
Not a huge one, although in some very small sense it is less efficient.

Basically, you use DynamicVariables=1 anywhere, measure or meter, where you use either a #Variable# that can be changed, or a [SectionVariable] in all cases.

For instance, IfCondition=MeasureName < 100 doesn't require DynamicVariables on the measure, however IfCondition=[MeasureName] < 100 does...
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am
Contact:

Re: Random Calc Activating ActionTimer?

Post by Krainz »

I see, thanks!

Also, should I be worried about that calc constantly updating regarding performance, crashes and such?
Post Reply