# Sequential text messages fading in/out PLUS Random Number Generation

Hi @russellcresser . Thanks so much for all your persistence and efforts with this - it is so much appreciated. There is a lot of stuff in there so let me try to wrap my head around this so that I understand what is going on. I hope you don’t mind in case questions come up to follow up…

Thanks again for all your community support!

1 Like

Hello @russellcresser: I made my way through all the code and setup and always am amazed of the multitude of coding approaches to reach a solution. No matter where this ends up going one always learn and it is an exciting journey. So thanks for sharing.

One thing I am not quite clear about is the ‘%’ operator - I think it is called modulus.
Is there a quick plain explanation what the code below (fade in/out rectangles) exactly does and what is the advantage of using the ‘%’ operator?

`(100-((#DWE#)*100)%100)`

Also on the random() bit I have one question: I am thinking of something that would be more or less like a random ‘pick-a-number’ game. Say let the computer pick a number between 50 and 99 and display that number. Visually it is almost as if the computer is asked to calculate probability - so he spits out random numbers in fast succession in 2 digits displaying one over the other (like 10 numbers or so: 86, 54, 76, 63, 98,…) before finally showing a single random number. Is there a simple mathematical function for that?

Any hints greatly appreciated… and thanks again.

1 Like

Explaing things is the most difficult.

`(100-((#DWE#)*100)%100)`

To fade the opacity we need a number 0 to 100. In this case 100 to 0. Thus the Formula begins `100-`
So we need to convert the DWE time to a series of 0 to 100 sequences.
Modulo devides by the number goven and shows you the Remainder. A real bit of Voodoo. I would do some tests to make yourself Famillar with it.
Have a look at things like #DWFSS#%15 and stuff like that.
A favourite timer of mine Is #DNOW#. Show that Modulo that is fun.

Sadly the random number is selected on Wake as its title. I have never had any luck doing what you are asking. You could fake some random sequence using the random number as a seed. Then show the one that was chosen by the system at the end.
I have done some tests round that but it is not in my head it is on the Laptop.

If you made some little tests and post an Inspectable link her we can look at it and help that way.

Here is a Face my Friend end Gizmo411 @icrltd4 made. A fine example if Random being used.

1 Like

Hello @russellcresser - thanks for the explanation - very helpful.

This is more like a game - when you click the center of the watch the second hand (needle) shoots out and sticks to the edge of the watch screen. The second hand rotates at 4 times the speed - otherwise it is too slow. The needle actually should stick where the second hand points to at the time of pressing the button - but for demonstration purposes and since I can’t get this one to work I have set it to a single fixed point.

Once I press the button there is also a random number activated form 50-99 but currently it just counts without stopping at a random number which would be preferred.

After 2 seconds the needle reloads and you can start again. Hope this is explains it a little…

1 Like

Ha Ha . Very Good . Post the other link . I did not realise you are a PRO . You have another timer you can use . You might have used it I will look later . #VAR_1-TE# .

Will check it in a hour or so. Well done posting the Inspectable.

1 Like

1 Like

@timeasart .I see you have found TE . I have not got the time at the moment to get my head around what you have done . I see your running rand looks like it is polling in Milliseconds . I wonder if we can use TE to capture a number very quickly from it , We have no access to the RAM so we can not store numbers for use later in the process. Give us access to the EPROM and we can make a decent Barometer Graphs and so on .

So I see what is going on with the seconds hand .
I have slowed it down to normal for this trick .
Pot a bit of orbit in the naughty tail of the hand .
See you don’t need the TE >0 but I understand it is there if you want to use it later .

you dont need

\$`#VAR_1_TE#>=0&&`#VAR_1_TE#<2000?100:0\$

just this

`\$#VAR_1_TE#<2000?100:0\$`

good visual aid in a text layer

`((#VAR_1_TE#)/1000)`

SECOND HAND ACTION

X POS

`\$#VAR_1_TE#<2000?(160+(160*cos(rad(#DWFSS#-90)))):160\$`

Y POS

`\$#VAR_1_TE#<2000?(160+(160*sin(rad(#DWFSS#-90)))):160\$`

ROTATION

`#DWFSS#`

Here is a Test of an Idea proposed by one of the Giants back in 2019.
get a load of apparently random numbers out of the Wake timer .
WIP so it might change.

Sorry It previews as running counts on here . I have had it on my watch works fine .

Hello - I plugged in your numbers for the x,y positions and it now points correctly - question is now: can it stop to rotate once it hits the edge of the watch so it maybe works more like a stop watch at that point?

1 Like

… and for the random value - could this be something like the wakeRand() + #DNOW# and that ends up displaying a single number between 55-99?

1 Like

You can limit values, by using the “clamp” function.

1 Like

Hey good Idea. wakeRand55 + TE%99 . #DNOW# is a Cumbersome number . I will tack a test of that on to the WIP . You must decide if you want to use Pro Taps on this one .

Hello - thanks so much for following up - could you let me know what the 'Pro Taps" feature is?

1 Like

Hey Sorry just different ways of talking about the same thing . #VAR_1_TE# is a Facer Pro thing . It reacts to a Screen Tap . Pro Taps.
See I have Butchered the Test . You will see the new stuff down the bottom . three different ways of doing the same thing . All pick up random on Wake . Obviously what I was trying to demonstrate earlier is it does not have to be displayed till later .

I notice the Preview runs wild for a bit then settles down .

Hello - thanks for setting this up. Yes, I like to keep the random number linked to the tap. Now if we can get one single number random displayed on the tap event (#VAR_1_TE#) then we got it. the wakeRand() would not work in that case since it always would be the same. We still could use the randWake() as a starting point and then add a fixed number like #DNOW#. Any time we add something timer based (TE) it starts counting - so the challenge is to get a static number which is random between a specified range.

I know this is quite a challenge…

1 Like

We are there now since you made it clear exactly how you want it to work . You must be aware that the DNOW silliness is a running number but if yo divide it by a Million it is not going to change for at least a year . I will make a separate test. That one is good for No Pros . I want to sort this soon as I have to do some other Stuff . BTW we will not use TE but just display on toggle . We can use INC DEC possibly to show different numbers . I will see what the TEST throws up .

1 Like

@timeasart . Check this . Quite interesting . Click on the bottom number . The number on the left is for ref and testing only so you can see what is happening . VAR_2 will just carry on getting bigger and bigger until you swap the face .
.
.
.

1 Like

Hello - well, what can I say - you are simply amazing and inspiring! This is exactly what I was hoping to achieve with this.

Quick question: if the min, max numbers change (currently 55/97) does anything in the code have to be adjusted in addition to the numbers?

Thanks a zillion again - one really can see all the passion you have for coding and solving problems!

2 Likes

I thought we were going for 55 to 99. Just change the numbers and see what happens. The variable is under Modulus so just seet that to what you want. The multiplication factors are just made up numbers just keep them odd or prime. It is just to get some distribution. It is not proper maths just a bodge up but if it works it does the job. If you click it enough you wil see a pattern. But that is the same with any Random. On a computer it is always Psudeo.