home *** CD-ROM | disk | FTP | other *** search
- # autosave script
- # (c) 1998 Simon Windmill, simon@wfmm.com
- # windmill fraser multimedia, inc. http://www.wfmm.com/
- #
- # This is a scene script, load it and press play. Now your scene will be
- # saved automatically to a backup!
- # You must set your tick interval to 1000
-
- import time
-
- # Time, in minutes, between saves
- # (it is a 'constant', so we can leave it like that)
- TimeDelay = 1
-
- # The base scene filename including path
- # Note that you must use double characters for backslashes
- BaseSceneName = 'c:\\temp\\leetscenebackup'
-
- def ontimestarted():
- # We need to reset some variables here
-
- # The number of times the scene is saved
- global SceneNumber; SceneNumber = 0
- global LastSavedTime; LastSavedTime = round(time.time())
-
- def ontimechanged():
- global SceneNumber, LastSavedTime
-
- # Check to see if it's time to save a backup
- # sometimes an ontimechange() routine call is not called at the
- # propper time (equal to X * TimeDelay * 60), so
- # if round(time.time()) % (TimeDelay * 60) == 0:
- # doesn't work
- if round(time.time()) - LastSavedTime > TimeDelay * 60:
-
- # update last saved time var
- LastSavedTime = round(time.time())
-
- # increment the save count..
- SceneNumber = SceneNumber + 1
-
- # ..and save the scene
- trueSpace.SaveScene(BaseSceneName + str(SceneNumber) + '.scn')
-
- # ..aaand also write a little message about it
- print BaseSceneName + str(SceneNumber) + '.scn saved at ' + time.asctime(time.localtime(time.time()))
- # this is the newline character
- print '\n'
-
-