Hi everyone.
I would like to be able to allow or deny access to the content of the game I am creating based on the time of day.
More specifically, I want to impose a curfew that would prohibit going to a go to a card game between 8 a.m. and 10 p.m.
So far, this is how I've done it: I created a field called “hour” with the following content:
"on change val do
end
on view do
p:“%p” parse “%e” format sys.now
b:(p.hour)
end"
Then a button that checks the content of this field:
"if
home.widgets.hour.text=21
dd.say[“ACCESS DENIED”]
dd.close[]
elseif
home.widgets.hour.text=22
dd.say[“ACCESS ALLOWED”]
dd.close[]
go[“card1” ‘Dissolve’]"
In this situation, only two hours are checked...
I would also like to be a little permissive, allowing the button to go to the next card as long as the seconds contain a “7.”
And finally, I would like to add an easter egg if players click on the button on a specific time (combination of hour and minute, for example 12:13)
Could you tell me how to do this? I don't know how to code this in an elegant and logical way.
Thanks :)
