Time based threshhold

Hey friends,

Is it possible to have an image change to another image based on if a certain threshold of steps has been achieved by a certain time in the day?

Thanks!

1 Like

There is a way to imitate this behavior. You can add two images and change their opacity based on a certain threshold of steps. Here is how you would do it:
Step 1: Open a project in the watch face studio.
Step 2: From the Add Component section add two (or more) images.
Step 3: Select one image


Step 4: From the properties tab go to Color section and select Opacity.

Step 5: Set the value to 0 and click Tags.
Step 6: Add the following Tag Expression
[SC]>5000?100:0
Put your desired threshold instead of 5000. And before the question mark you can put any expression that returns a boolean. In your case if a certain threshold of steps has been achieved by a certain time in the day.
image
Step 7: Repeat Step 3 to 6 for other images as well. In this case use the following Tag Expression for the second image.
[SC]>5000?0:100
Step 8: Place them at the same position.
Step 9: Test if it is working.

3 Likes

Not an answer, but I like the idea. I wrote an app (with complications) that indicated steps (and calorie, etc) progress compared to time of day.

2 Likes

Great! Iā€™ll try this out tomorrow.
One thing Iā€™ll have to figure out is how to get it to do the above at the time, so set opacity to 0 if steps are under 2000 by 9pm, etc

1 Like

You can combine multiple boolean expressions using and/or operations

1 Like

The secret is the Boolean for AND on WFS is * . Remember you can use the Users Steps Goal in WFS Tag Formulas . Shout if you get stuck . It is so much more satisfying if you get it by yourself .

BTW + is OR . You will have to look up the rest .

2 Likes

Got it!

The answer was the brackets and the * for ā€œandā€, thanks @imrulanwar836 & @russellcresser

ā€œ([SC]>5000)*([HOUR_1_24])>21?100:0ā€
in english:
if stepcount is greater than 5000, and itā€™s after 9pm - turn this imageā€™s opacity from 0-100 :slight_smile:

Youā€™re right though, figuring out the last part myself was way more satisfying <3

3 Likes

Great well done . I think I am right in saying that you can nest 3 conditionals if you need to .

Ok, hereā€™s one last piece of the puzzle, but let me explain whatā€™s actually happening first:

For my watchface, I have an image sequence of a creature that changes based on what percentage of your daily walking goal youā€™ve done. Itā€™s essentially a tamagotchi that evolves based on walking. What Iā€™ve currently got is code that says ā€˜if you donā€™t have more that 10% of your daily goal done before 9pmā€™, the creature dies (eg, itā€™s spriteā€™s opacity is 0, and the gravestone sprite appears).

This is all currently working a treat - but I realised yesterday that if you then achieve more than 10% of your step count AFTER 9pm, the creature appears again and the grave goes away, because the creatureā€™s set to:
([SC_PER]<10)*([HOUR_0_23])>20?0:100

and the grave is set to:
([SC_PER]<10)*([HOUR_0_23])>20?100:0

So is there any way to to store a value? Like say "at 9pm, if you havenā€™t walked more than 10% of your goal, the grave appears and also ā€˜DEAD=1ā€™
And then for the other sprites they basically have "If youā€™ve walked X-AMOUNT of step percentage, and DEAD doesnā€™t = 1, turn opacity to 100.

Or is there another way to so something like this if we canā€™t store values?

Apologies for my not-overly-programming-centric brain!
J

1 Like

I think with WFS wont be possible to workaround no data storage, since they still consider it being designer and not developer tool and also that watchfaces with new format are not meant to execute anything, like they are no real applications. You would need to program what you want in something more capable maybe like android studio and maybe even into an app or complication, rather than just watchface.

1 Like