once a day
Created at 26 May 2015, 13:55
once a day
26 May 2015, 13:55
Hi everyone!
I'm new here and I'm trying to write an algoritm that check some conditions once a day at a determinate hour.
Can somebody help me?
Thank you!
Replies
deklin
26 May 2015, 14:10
RE:
Sorry, I made a typo above... It should be:
using System; using cAlgo.API; using cAlgo.API.Internals; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class SampleSmartBotRobot : Robot { bool doneToday; protected override void OnStart() { doneToday = false; } protected override void OnTick() { var currentHour = int.Parse(Server.Time.ToString("%H")); if (currentHour >= 8 && doneToday == false) { doneToday = true; Print("This is done once per day at 8:00 am UTC or as close after that time as possible."); } else if (currentHour <= 1) { doneToday = false; } } } }
@deklin
deklin
26 May 2015, 14:08
@deklin