It is currently May 1st, 2024, 11:38 am

Need help with setting counters to this code correctly

Get help with creating, editing & fixing problems with skins
Wyld_Goose
Posts: 36
Joined: May 12th, 2012, 3:23 am

Need help with setting counters to this code correctly

Post by Wyld_Goose »

I think I may just be fried with 15 hours of reading, coding and rereading. I know what I need to be working with is counters, but my brain is mush at this point of the night. I need to (based on Measure=Time Format=%S) {{or no Format=%S if I don't need it}} to set 2 different variables for a meter on the next update, then to a different set the next update and then back to the original the next update. Back and forth with each new update. This should be simple but I'm my brain hurts right now.

Here's the ugly code I have. Should explain what I'm trying to do. I know it's wrong, mostly because it doesn't work. heh

Code: Select all

[Variables]
PenStart=0.1222
PenRotation=-0.2443
PenCounter=0

[MeasureTime1]
Measure=Time
Format=%S
Formula=#PenCounter#
IfEqualValue=1
IfEqualAction=!Execute [!SetVariable PenStart -0.12217][!SetVariable PenRotation 0.2443][!SetVariable PenCounter 0]
IfBelowValue=1
IfBelowAction=!Execute [!SetVariable PenStart 0.12217][!SetVariable PenRotation -0.2443][!SetVariable PenCounter 1] 
I read the manual, forums and look at codes to other skins, and I swear it's like being able to slightly read another language but not being able to write in it.
Wyld_Goose
Posts: 36
Joined: May 12th, 2012, 3:23 am

Re: Need help with setting counters to this code correctly

Post by Wyld_Goose »

Ok no response yet. hmmm. Here is a solution to my issue but it is way ugly, but it works.

Code: Select all

[MeasureShift1]
Measure=Time 
Format="%S"
IfEqualValue=01
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift2]
Measure=Time 
Format="%S"
IfEqualValue=02
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift3]
Measure=Time 
Format="%S"
IfEqualValue=03
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift4]
Measure=Time 
Format="%S"
IfEqualValue=04
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift5]
Measure=Time 
Format="%S"
IfEqualValue=05
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift6]
Measure=Time 
Format="%S"
IfEqualValue=06
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift7]
Measure=Time 
Format="%S"
IfEqualValue=07
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift8]
Measure=Time 
Format="%S"
IfEqualValue=08
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift9]
Measure=Time 
Format="%S"
IfEqualValue=09
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift10]
Measure=Time 
Format="%S"
IfEqualValue=10
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift11]
Measure=Time 
Format="%S"
IfEqualValue=11
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift12]
Measure=Time 
Format="%S"
IfEqualValue=12
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift13]
Measure=Time 
Format="%S"
IfEqualValue=13
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift14]
Measure=Time 
Format="%S"
IfEqualValue=14
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift15]
Measure=Time 
Format="%S"
IfEqualValue=15
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift16]
Measure=Time 
Format="%S"
IfEqualValue=16
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift17]
Measure=Time 
Format="%S"
IfEqualValue=17
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift18]
Measure=Time 
Format="%S"
IfEqualValue=18
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift19]
Measure=Time 
Format="%S"
IfEqualValue=19
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift20]
Measure=Time 
Format="%S"
IfEqualValue=20
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift21]
Measure=Time 
Format="%S"
IfEqualValue=21
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift22]
Measure=Time 
Format="%S"
IfEqualValue=22
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift23]
Measure=Time 
Format="%S"
IfEqualValue=23
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift24]
Measure=Time 
Format="%S"
IfEqualValue=24
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift25]
Measure=Time 
Format="%S"
IfEqualValue=25
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift26]
Measure=Time 
Format="%S"
IfEqualValue=26
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift27]
Measure=Time 
Format="%S"
IfEqualValue=27
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift28]
Measure=Time 
Format="%S"
IfEqualValue=28
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift29]
Measure=Time 
Format="%S"
IfEqualValue=29
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift30]
Measure=Time 
Format="%S"
IfEqualValue=30
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift31]
Measure=Time 
Format="%S"
IfEqualValue=31
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift32]
Measure=Time 
Format="%S"
IfEqualValue=32
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift33]
Measure=Time 
Format="%S"
IfEqualValue=33
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift34]
Measure=Time 
Format="%S"
IfEqualValue=34
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift35]
Measure=Time 
Format="%S"
IfEqualValue=35
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift36]
Measure=Time 
Format="%S"
IfEqualValue=36
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift37]
Measure=Time 
Format="%S"
IfEqualValue=37
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift38]
Measure=Time 
Format="%S"
IfEqualValue=38
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift39]
Measure=Time 
Format="%S"
IfEqualValue=39
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift40]
Measure=Time 
Format="%S"
IfEqualValue=40
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift41]
Measure=Time 
Format="%S"
IfEqualValue=41
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift42]
Measure=Time 
Format="%S"
IfEqualValue=42
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift43]
Measure=Time 
Format="%S"
IfEqualValue=43
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift44]
Measure=Time 
Format="%S"
IfEqualValue=44
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift45]
Measure=Time 
Format="%S"
IfEqualValue=45
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift46]
Measure=Time 
Format="%S"
IfEqualValue=46
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift47]
Measure=Time 
Format="%S"
IfEqualValue=47
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift48]
Measure=Time 
Format="%S"
IfEqualValue=48
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift49]
Measure=Time 
Format="%S"
IfEqualValue=49
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift50]
Measure=Time 
Format="%S"
IfEqualValue=50
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift51]
Measure=Time 
Format="%S"
IfEqualValue=51
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift52]
Measure=Time 
Format="%S"
IfEqualValue=52
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift53]
Measure=Time 
Format="%S"
IfEqualValue=53
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift54]
Measure=Time 
Format="%S"
IfEqualValue=54
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift55]
Measure=Time 
Format="%S"
IfEqualValue=55
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift56]
Measure=Time 
Format="%S"
IfEqualValue=56
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift57]
Measure=Time 
Format="%S"
IfEqualValue=57
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift58]
Measure=Time 
Format="%S"
IfEqualValue=58
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

[MeasureShift59]
Measure=Time 
Format="%S"
IfEqualValue=59
IfEqualAction=!Execute [!ShowMeter "MeterLeft"][!HideMeter "MeterRight"]

[MeasureShift00]
Measure=Time 
Format="%S"
IfEqualValue=00
IfEqualAction=!Execute [!ShowMeter "MeterRight"][!HideMeter "MeterLeft"]

  
Im looking to have the skin alter between two .png's every second. The problem I have run into with trying to this with a counter is that I'm going between "on and off" for the most part, or "1 or 2". Because the counter doesn't take effect til the next update, it gets stuck on 1. I don't know. I figure the solution is simple and will be a total facepalm moment when I see it. For now, this code works but is a waste of CPU seeing how there are 60 measures running for this two-step-repeat process.


This is the same problem. I'm trying to see if I can use the animated "bitmap" technique, switching perfectly in time with %S, rather the Rotation. I may try them both once I solve this, and see which works better with the least CPU.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Need help with setting counters to this code correctly

Post by jsmorley »

If I am understanding that you want to toggle between two images once a second, this will work and use very little CPU:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureSwitch]
Measure=Calc
Formula=(MeasureSwitch % 2) + 1
IfEqualValue=1
IfEqualAction=!SetOption MeterImage ImageName Images\No.png
IfAboveValue=1
IfAboveAction=!SetOption MeterImage ImageName Images\Yes.png

[MeterImage]
Meter=Image
The [MeasureSwitch] measure will alternate between 1 and 2 every Update (which is 1000, or once a second) then the IfActions on the measure will set the ImageName option on the Image meter to the desired .png.

You can use the same counter, changing the !SetOption to set a RotationAngle on a Rotator meter, change the ImageTint on an Image meter. Whatever fits the bill for you. You can have it do more than one thing by putting each action inside "[]" brackets.

You do need to be careful about having it use !SetVariable to set the value of a variable, as you will be one "Update" out of sync, as the change to the variable will happen on update 1 and the "use" of the variable by other meters or measures will happen on the next update, or update 2.
Wyld_Goose
Posts: 36
Joined: May 12th, 2012, 3:23 am

Re: Need help with setting counters to this code correctly

Post by Wyld_Goose »

I appreciate the response.

Unfortunately the skin already is running with an Update=100 and am wanting to link the toggle with actual %S rather then attempting to just UpdateDivider=10 because the toggle ends up being off from real time.

I can't tie a [MeasureSwitch] to a [MeasureTime] and then attempt to use a Formula to do "(MeasureSwitch % 2) + 1" because it requires a "Calc" as the "Measure=". example:

Code: Select all

Update=100

[MeasureTime]
Measure=Time
Format=%S

[MeasureSwitch]
Measure=MeasureTime
Formula=(MeasureSwitch % 2) + 1
IfEqualValue=1
IfEqualAction=!Execute Something
IfAboveValue=1
IfAboveAction=!Execute Something 
That doesn't work, going the long way with 60 measures that (Measure=Time, Format="%S", IfEqualValue=01, IfEqualAction=!) does work with Time on an Update=100 skin.

Would there be a shorter way of doing this in this situation? Yeah the !SetVariables doesn't work because of the Update delay if it was tied to Measure=Time, and would be toggling 10 times if it was tied to the Update=100 which tends to not be synced with Time.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Need help with setting counters to this code correctly

Post by smurfier »

I need a really clear description of the end result you wish to achieve.
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
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Need help with setting counters to this code correctly

Post by smurfier »

In case all you want to do is toggle between two images every second:

Code: Select all

[Variables]
Test=0
Image=0

[Time]
Measure=Time
Format=%S

[msTest]
Measure=Calc
Formula=#Test#<>Time
IfAboveValue=0
IfAboveAction=[!SetVariable Test [Time]][!SetVariable Image (1-#Image#)]
DynamicVariables=1

[Image]
Meter=Image
ImageName=#Image#.png
DynamicVariables=1
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 . . .
Wyld_Goose
Posts: 36
Joined: May 12th, 2012, 3:23 am

Re: Need help with setting counters to this code correctly

Post by Wyld_Goose »

It's a pendulum for a clock set to Measure=Time. Swing right (1 second) swing left (1 second) and so on. Just tested my Animated Bitmap method and it hiccups. Looks as if I'm left with just making an Animated Bitmap that runs out of sync with the rest of the clock or just abandon it altogether