On the subject of time... So, I did make Tea and Bread (as Millie mentioned -- thanks!) using the .beat clock for my timers.
Specifically this version of it that sends out events and it does work for creating timers. It definitely does that.
But you can also skip the clock contraptions and make a simple text field or slider widget into a timer instead.
Using a text field as an example:
1. Make a field
2. Set it to be animated in the widgets menu (so that it experiences 60 'on view do' events per second)
3. Write a tiny script so that it increases the number inside the field every time there's a 'on view do' event:
on view do me.text:me.text+1 end
Ta-dah! It's the basic building block of a timer. This version of it will make the number go up forever.
But since we want to change cards when we hit a certain amount of time.... we can do something like this:
on view do if me.text=300 # if the timer has reached 5 seconds (5 x 60 = 300) # me.text:0 # reset the clock # go[home] # and go to another card # else me.text:me.text+1 end end
300 view events (5 seconds) is way too fast for what you're planning -- but I hope it's a nice understandable number for testing.
Any amount of time you want to use in your scripts should be converted into seconds, and then multiplied by 60 -- this is the total number of 'on view do' events that must happen before you reach your intended time.
----
Now, the bit I'm not sure about is the pointer -- I've never done anything with pointer.pos and I'm not sure how to script that off the top of my head (Sorry!)
But I will bring up the issue of mobile users, and offer an alternative (until someone more familiar with pointer comes along...)
It's a nice feature of Decker that the majority of decks work the same on touchscreen devices like phones and tablets as they do on computers.... but these devices don't track pointer.pos in the same way. They don't usually have a cursor to track the position of. (I think Decker just looks at the most recent tap on touchscreens...?)
It's possible that this is fine for your project and having it work slightly differently on mobile isn't a big deal. But, y'know, something to think about.
So here is a possible alternate version of your request -- one that resets the clock when there's a click/tap, rather than while the player is moving their mouse cursor:
on view do if pointer.held # if a click happens # me.text:0 # reset clock # elseif me.text=300 #else, if we've reached 5 seconds on the clock....# me.text:0 # reset the clock # go[home] # and go to another card # else me.text:me.text+1 # make number go up# end end
And here's this version of the field widget to copy-paste into your deck if you'd like to mess with it :
%%WGT0{"w":[{"name":"field1","type":"field","size":[36,15],"pos":[228,35],"animated":1,"script":"on view do\nif pointer.held\nme.text:0\nelseif me.text=300\nme.text:0\ngo[home]\nelse\nme.text:me.text+1\nend\nend","show":"transparent","value":"0"}],"d":{}}
I hope this gives you something to work with!
And alternatively, if you wanted to use a slider instead of a text field for some reason:
Use me.value in the script instead of me.text and make sure to set the maximum value of the slider to at least the number you intend for it to reach.