home *** CD-ROM | disk | FTP | other *** search
- on startMovie
- global firstDayOfMonthList, thisMonth, dayList, monthList, thisYear, pictureFlag, offsetX, offsetY, width, height, minderSprite, calPath, CDPath, HDPath, linkString, pictureName
- set the timeoutPlay to 1
- set pictureFlag to 1
- set firstDayOfMonthList to []
- set linkString to EMPTY
- set minderSprite to 18
- puppetSprite(minderSprite, 1)
- set the trails of sprite minderSprite to 1
- puppetSprite(2, 1)
- globalButtonInit(45, 48)
- set offsetX to 236
- set offsetY to 70
- set width to 55
- set height to 43
- set dayList to ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
- set monthList to ["January", 31, "February", 28, "March", 31, "April", 30, "May", 31, "June", 30, "July", 31, "August", 31, "September", 30, "October", 31, "November", 30, "December", 31]
- put EMPTY into field "selected"
- set the cursor of sprite 48 to -1
- set thisYear to value(word 4 of the abbr date)
- setUpYear()
- set thisMonth to word 2 of the long date
- put thisMonth && thisYear into field "monthName"
- setCal()
- set x to getPos(monthList, thisMonth)
- set the castNum of sprite 2 to 40 + ((x + 1) / 2)
- set file to char 1 to 3 of thisMonth & pictureFlag + 1 & ".PCT"
- set the fileName of cast 10 to calPath & "calndr1\" & file
- set the mouseDownScript to "click"
- end
-
- on click
- if the frame = 11 then
- dontPassEvent()
- exit
- end if
- if the clickOn then
- puppetSound("click1.aif")
- updateStage()
- puppetSound(0)
- end if
- end
-
- on stopMovie
- global minderSprite
- puppetSprite(minderSprite, 0)
- puppetSprite(2, 1)
- puppetSprite(43, 0)
- clearMinder()
- freeSprites(45, 48)
- end
-
- on setUpYear
- global firstDayOfMonthList, thisYear
- cursor(4)
- set asciiYear to string(thisYear)
- set century to value(char 1 to 2 of asciiYear)
- set tyear to value(char 3 to 4 of asciiYear)
- set day to 1
- repeat with i = 1 to 12
- set month to i
- set year to tyear
- if month < 3 then
- set month to month + 10
- set year to year - 1
- else
- set month to month - 2
- end if
- set dow to (((26 * month) - 2) / 10) + day + year + (year / 4) + (century / 4) - (2 * century) + 777
- set dow to (dow mod 7) + 1
- setAt(firstDayOfMonthList, i, dow)
- end repeat
- cursor(-1)
- end
-
- on showPic
- global thisMonth, hmpList, calPath, pictureFlag
- set x to value(word 2 of field "monthName")
- set pictureFlag to x mod 2
- cursor(4)
- set file to char 1 to 3 of thisMonth & pictureFlag + 1 & ".PCT"
- set the fileName of cast 10 to calPath & "calndr1\" & file
- updateStage()
- set file to char 1 to 3 of thisMonth & ".txt"
- set fileObject to FileIO(mnew, "read", calPath & "calndr1\" & file)
- if fileObject < 0 then
- alert("can't read file" && calPath & "calndr1\" & file)
- put EMPTY into field 18
- else
- put fileObject(mReadFile) into field 18
- fileObject(mdispose)
- end if
- set year to char 3 to 4 of word 2 of field "monthName"
- set file to char 1 to 3 of thisMonth & year & ".hmp"
- set fileObject to FileIO(mnew, "read", calPath & "calndr1\" & "facts\" & file)
- if fileObject < 0 then
- set hmpList to EMPTY
- else
- set hmpList to fileObject(mReadFile)
- fileObject(mdispose)
- end if
- cursor(-1)
- end
-
- on factSearch date
- global hmpList
- put EMPTY into field "HMP Field"
- repeat with i = 1 to the number of lines in hmpList
- if (i mod 2) = 0 then
- next repeat
- end if
- if line i of hmpList starts date then
- put line i + 1 of hmpList into field "HMP Field"
- exit repeat
- end if
- end repeat
- delete char the number of chars in date of date
- repeat with i = 1 to the number of lines in field 18
- if (i mod 2) = 0 then
- next repeat
- end if
- if line i of field 18 starts date then
- put line i + 1 of field 18 into field "factField"
- exit repeat
- end if
- end repeat
- end
-
- on leapCheck
- global thisYear, monthList
- set q to thisYear mod 4
- if q = 0 then
- setAt(monthList, 4, 29)
- else
- setAt(monthList, 4, 28)
- end if
- end
-
- on makeFile theDate
- global minderFileName, thisYear, thisMonth, HDPath
- cursor(4)
- put theDate into field "selected"
- set z to string((getPos(monthList, thisMonth) + 1) / 2) & "/"
- put word 3 of theDate & "/" after z
- factSearch(z)
- set minderFileName to HDPath & "calndr1\" & thisYear
- put word 3 of theDate after minderFileName
- put "." & char 1 to 3 of thisMonth after minderFileName
- set fileObject to FileIO(mnew, "read", minderFileName)
- if fileObject < 0 then
- put EMPTY into field 13
- else
- put fileObject(mReadFile) into field 13
- fileObject(mdispose)
- end if
- cursor(-1)
- if the frame < label("reminder") then
- go("reminder")
- end if
- end
-
- on reminderTest
- set n to label("reminder") + 1
- if (the frame = n) or (the frame = (n + 1)) then
- if field 13 <> EMPTY then
- writeFile("write")
- else
- writeFile("delete")
- end if
- end if
- end
-
- on writeFile job
- global minderFileName
- set fileObject to FileIO(mnew, "write", minderFileName)
- if fileObject < 0 then
- alert("we've had an error saving the file" && minderFileName)
- else
- set n to value(word 3 of field "selected")
- if job = "write" then
- fileObject(mWriteString, field 13)
- fileObject(mdispose)
- removeMinder(n, 1)
- else
- if job = "delete" then
- fileObject(mDelete)
- removeMinder(n, 0)
- end if
- end if
- end if
- end
-
- on removeMinder dayNumber, setClearFlag
- global offsetX, offsetY, height, width, minderSprite, firstDay
- set location to dayNumber + firstDay - 2
- if setClearFlag = 0 then
- set the trails of sprite minderSprite to 0
- end if
- set the locV of sprite minderSprite to offsetY + (location / 7 * height)
- set the locH of sprite minderSprite to offsetX + (location mod 7 * width)
- updateStage()
- set the locV of sprite minderSprite to -20
- set the locH of sprite minderSprite to -20
- updateStage()
- set the trails of sprite minderSprite to 1
- end
-