I want to have a global timer going in my deck that can detect if the player has done a given action within the last 5 minutes. If they have done that action, I want to reset my timer.
timer with animated widget
I’ve figured out I can create a timer by animating a widget and setting its value on view, with a script like this:
on view do
me.text: me.text + 1
#if me.text = 3600
# my_event[]
#end
end
I think I can use my_event later to trigger my time out behavior. I think I could reset the timer’s current value to reset the countdown fine.
My current issue is that I want this timer to be tracking time globally and not just on a single card. From what I can tell, my timer widget is only animated if it is on the current card.
Is there a reasonable way to get a timer this?
trying to copy paste timer widget
The current thing I’m trying to do is figure out how to copy/paste the widget across views cribbing some notes from this topic: https://itch.io/t/3658580/moving-widgets-between-cards-while-interacting-with-deck
I’m having trouble adapting it to my case though. I don’t seem to see go being triggered on my deck level script. I’m not seeing view being triggered consistently on my deck level script either.
I’m not seeing the go!!! print in my listener ever and am only seeing the current card print on one of the cards in my deck and not the rest.
on go dest trans delay do
print["go!!!"]
print[dest trans delay]
send go[dest trans delay]
end
on view do
print["current card:", deck.card.name]
end
