Limiting VAR values

Is there a way to bound (limit values) assigned to VARs (#VAR_1$, #VAR_2#, etc.) so that they won’t exceed upper (max) or lower (min) values?

I’m doing a dual time display and I want to limit the #VAR_1# to be within the recognized time zones (roughly -11 to +14).

I’m using the #VAR_1# value plus UTC hour (#DUH#) to drive the dual time hour hand which works pretty well.

Hello again mark. To limit your VAR you need to use Modulo operator also, like this. (#VAR_1#%26)
This will prevent the VAR value from exceeding 26. If you try to increase past 26 then it will roll back to 0. VAR always start at 0 not 1, this is important to know when coding your VARS. Another important thing to know is that if you sync a face and it starts at 0 and you try to decrease from 0 to 26 it doesn’t roll over like it does the other way. Instead it goes to -1 and nothing happens on the screen. If you want the user to be able to go back and fourth not just one way then you need to do it like this. ((#VAR_1#+260)%26)
When doing this you’re actually starting at 260 so if you decrease it will be 259 instead of -1. It will still only have 26 segments though.

I hope all that makes sense.

1 Like

Yes it makes sense, but it appears that while I can use modulus or other logic to limit calculated values, I can’t really limit or set VAR_1 (except by the Increment, Decrement and Reset user actions).

I hate to seem like a total noob, but I can’t figure out where to limit the #VAR_1# and others.

I’d like to make the bottom left silver button rotate through 4 or 5 bezels instead of toggling between just two.

Where do I plug in something like this?

((#VAR_1#+260)%5)

This is the current face I’m working on…

1 Like

Hi @facer.io2 , nice looking face.

If post the expressions you are using to move the button i’ll take a look.

1 Like

I’m not trying to move buttons. I’m trying to set up an “Increment Add” button to cycle through 4 or 5 different bezels.

I’m asking WHERE to put this expression:

((#VAR_1#+260)%5)

Where is the above expression entered in the Creator app?

Ok.

The expression you have will return a number from 0 to 4 and will repeat through that cycle as Var1 increases. The addition of the number 260 will not have any impact as it is a multiple of 5. It is not clear what you are trying to achieve with the expression in general and by adding 260 to the variable in particular.

If I have five images that I want to cycle through based on the user’s input, I place a variation of the same expression in the opacity field of each image layer.

image 0: $(#VAR_1#%5)==0?100:0$
image 1: $(#VAR_1#%5)==1?100:0$

image 4: $(#VAR_1#%5)==4?100:0$

I hope that helps.

1 Like

IMMENSELY SIR.

You Rock!
Thanks again.

1 Like

You are most welcome!

:grinning: