Better Code (GetTime() get current year)?

Started by R4L, Thu 15/12/2005 23:53:53

Previous topic - Next topic

R4L

I have this code for a little cheat in my game:
Code: ags

in repeatedly_execute:
GetRawTime();
if ((GetTime(5) == 3) && (GetTime(4) == 4)){
Display("Cheats");
Display("Actually, there are no cheats! Keep looking!");


It works because it checks if the user's computer clock is set to March 4, but because it does not check the year I won't accept this. The GetTime(); function does not have years. Can someone help me with this?

Ashen

#1
Actually, GetTime() does have years - it's GetTime(6);.

I can't remember off-hand whether it returns 2 or 4 digit (i.e. "05" or "2005"), but I think it's 4.

(And, of course, if you're using 2.7+, you should really use the DateTime.Day/Month/Year/etc properties.)
I know what you're thinking ... Don't think that.

Gilbert

Actually AGS can only return the year correctly for V2.7+, this feature was added back in V2.62 but it never worked.

Ashen

That's odd, I'm sure it worked in AoK before we upgraded to 2.7 ... Let me check ...

Ah, yes, it seems like it returns the years since 1900 (so "105", not "2005"). Would this be good enough for your purposes, Rap4Life42o?

The alternative, I guess, is to get the Raw time, divide it by the number of seconds in a year (31,557,600) and add that to 1970 (when the RawTime 'clock' started).
I know what you're thinking ... Don't think that.

Gilbert

Right, the millenium bug kicked in when you use V2.62, though of course it can be compensated, still basically it's not working properly.

SMF spam blocked by CleanTalk