2017년 8월 1일 화요일

How to fire a Random Clock?


Can anyone lead me in the right direction for firing a random clock?   Basically when a button is pushed, I want a random clock to be fired and the clock set off a chain of events.  

--
Further details are needed.

If it's a small number of predefined actions that you want to happen, and your code will be substantially different between any one action and the next (aside from choice of sound or picture, which you could otherwise just randomly choose from a list), you could pull out some small number of inactive clocks in the Designer, and at Screen1.Initialize time collect their components into a global list, for use by your random event selector and the Any Clock blocks.  

You would need to code Clock.Timer events for the different Clocks.

If it's just random sounds, times, but the same processing, you can work with just one Clock and pull your sounds, text, pictures from lists randomly.

If you need the Clock to fire at a random time within the next hour, you can calculate a random number between 0 and 
(60 minutes/hour * 60 seconds/minute * 1000 milliseconds/seconds) milliseconds and set your clock to fire at that interval, not repeating.

Have I missed any thing?

--
Oh, and I forgot.
AI2 can't run in the background, so don't pick a long interval
or your phone might go to sleep.

--

댓글 없음:

댓글 쓰기