Jump to content


Photo

New Date Auto-advance Script


  • Please log in to reply
No replies to this topic

Poll: Do you want me to tidy this up and release it?

Do you want me to tidy this up and release it?

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.
Vote Guests cannot vote

#1 firefoxf7

firefoxf7

    X-S Young Member

  • Members
  • Pip
  • 40 posts

Posted 08 June 2004 - 08:00 PM

I have spent a while looking for a dash that will cause my clock to autoadvance between powerups (I dont mind if the date is wrong - I just want save games to be in the right order). After discovering MXM action scripts I wrote the following script which, when called from autoexec, does just that...

OPENREAD listFile date.txt
READFILELN listFile fileline
Set date %fileline%
READFILELN listFile fileline
Set month %fileline%
READFILELN listFile fileline
Set year %fileline%
CLOSEFILE listFile
Add date 1

IF# %date% > 28 GOTO NEWMONTH

:CHECKMONTH
IF# %month% > 12 GOTO NEWYEAR

:SETDATE
OPENWrite listFile date.txt
WRITEFILELN listFile %date%
WRITEFILELN listFile %month%
WRITEFILELN listFile %year%
CLOSEFILE listFile
Date %date% %month% %year%
GOTO DATEDONE

:NEWMONTH
Add month 1
SET date 1
GOTO CHECKMONTH

:NEWYEAR
Add year 1
SET month 1
GOTO SETDATE

:DATEDONE


It relies on a file called date.txt with the day, month and year on seperate lines, and increments the date between powerups by 1 day. It is very rough, assuming that all months have 28 days, and falling over if the date file is not there, but it works and is good enough for me. However, if anyone is interested I will improve it and tidy it up to make it work a bit better. Anyone interested?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users