In my game I plan to have a realtime day/night system but although i know it should be possible how would I make the game run a piece of code say at 5pm.
Please help i have no idea where to begin without this forums brilliant help.
DateTime functions & properties (http://www.adventuregamestudio.co.uk/manual/DateTime%20functions%20and%20properties.htm). (Particularly DateTime.Now and DateTime.Hour)
So something like:
DateTime *dt;
//rep_ex
dt = DateTime.Now;
if (dt.Hour == 17) {
// Do stuff at 5:00 PM
// Add dt.Minute and dt.Second checks to make it happen at EXACTLY 5, rather than for the whole hour
}
where would i put that exactly
You'd put it in the global script.
Insert this at the beginning, outside any function:
DateTime *dt;
The following belongs inside the repeatedly_execute function:
//rep_exÃ, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, Ã, <--- INDICATION OF WHERE TO PUT IT BY ASHEN
dt = DateTime.Now;
if (dt.Hour == 17) {
Ã, // Do stuff at 5:00 PM
Ã, // Add dt.Minute and dt.Second checks to make it happen at EXACTLY 5, rather than for the whole hour
}
i tried your code and it refuse to work but luckily with a little copying and pasteing
i managed to get exactly the scripting effect i wanted.
Now may game features a 24 hour day time /night time effect.
This sounds like "Your suggestion didn't work, but I got it working on my own by following your instructions." ;)