home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 January / Pcwk0198.iso / Dzieci / SIMPDATA / SIMPMAIN / 00001.ls next >
Encoding:
Text File  |  1996-09-01  |  6.5 KB  |  208 lines

  1. global interfaceMgr, paletteMgr, recordMgr, sndLPRecMgr, sndFXRecMgr, animRecMgr, bgdRecMgr, bgdFXRecMgr, fgdFXRecMgr, playbackMgr, layerMgr, listMgr, appMgr, editMgr, fileMgr, stackMgr, currentFrame, simpdataPath, simpsonsPath, dlogdataPath, toondataPath, exportPath, playBackMode, savedToonDataIndex, PCflag, statusWindow, alertWindow, thePlayerCartoonName
  2.  
  3. on startMovie
  4.   cursor(4)
  5.   set the mouseDownScript to EMPTY
  6.   set the keyDownScript to EMPTY
  7.   set the exitLock to 1
  8.   set currentFrame to 1
  9.   createObjects()
  10.   if playBackMode = #ReturnFromExport then
  11.     deleteXTMPLworkfiles(fileMgr)
  12.     set theMessage to "The exported cartoon named" && QUOTE & thePlayerCartoonName & QUOTE && "is now in your EXPORT folder."
  13.     set theAlertBoxType to #OK
  14.     if savedToonDataIndex <> 0 then
  15.       set actionItem to "readToonData(fileMgr, savedToonDataIndex)"
  16.     else
  17.       set actionItem to "nothing"
  18.       set playBackMode to #NIL
  19.     end if
  20.     showTheAlertBox(theMessage, theAlertBoxType, "nothing", "nothing", actionItem)
  21.   else
  22.     if playBackMode = #BEGIN then
  23.       if soundBusy(1) then
  24.         set oldVolume to the volume of sound 1
  25.         repeat while the volume of sound 1 > 0
  26.           startTimer()
  27.           set the volume of sound 1 to the volume of sound 1 - 8
  28.           repeat while the timer < 6
  29.           end repeat
  30.         end repeat
  31.         puppetSound(1, 0)
  32.         set the volume of sound 1 to oldVolume
  33.       end if
  34.       set the ink of sprite 46 to 0
  35.       set the ink of sprite 47 to 0
  36.       set the ink of sprite 48 to 0
  37.       set the castNum of sprite 46 to the number of cast "icon.place holder"
  38.       set the castNum of sprite 47 to the number of cast "icon.place holder"
  39.       set the castNum of sprite 48 to the number of cast "icon.place holder"
  40.       set the loc of sprite 46 to point(-985, 202)
  41.       set the loc of sprite 47 to point(-985, 202)
  42.       set the loc of sprite 48 to point(-985, 202)
  43.       unLoad()
  44.       preLoad(10, 10)
  45.       go("MAIN")
  46.     end if
  47.   end if
  48.   cursor(-1)
  49.   updateStage()
  50. end
  51.  
  52. on stopMovie
  53.   put "Untitled" into field "filenamefield"
  54.   put EMPTY into field "loopstatusfield"
  55.   put EMPTY into field "soundstatusfield"
  56. end
  57.  
  58. on createObjects
  59.   set interfaceMgr to birth(script 2)
  60.   set paletteMgr to birth(script 3)
  61.   set recordMgr to birth(script 4)
  62.   set playbackMgr to birth(script 5)
  63.   set listMgr to birth(script 6)
  64.   set layerMgr to birth(script 7)
  65.   set appMgr to birth(script 8)
  66.   set editMgr to birth(script 9)
  67.   set fileMgr to birth(script 10)
  68.   set stackMgr to birth(script 11)
  69.   set animRecMgr to birth(script 12)
  70.   set bgdRecMgr to birth(script 13)
  71.   set bgdFXRecMgr to birth(script 14)
  72.   set fgdFXRecMgr to birth(script 15)
  73.   set sndLPRecMgr to birth(script 16)
  74.   set sndFXRecMgr to birth(script 17)
  75. end
  76.  
  77. on puppetSprites start, finish, theState
  78.   repeat with theSpr = start to finish
  79.     puppetSprite(theSpr, theState)
  80.   end repeat
  81. end
  82.  
  83. on copyList sourceList
  84.   if not listp(sourceList) then
  85.     return []
  86.   end if
  87.   return value(string(sourceList))
  88. end
  89.  
  90. on incrementFrame
  91.   set currentFrame to currentFrame + 1
  92. end
  93.  
  94. on decrementFrame
  95.   set currentFrame to currentFrame - 1
  96. end
  97.  
  98. on resetFrameCounter
  99.   set currentFrame to 1
  100. end
  101.  
  102. on showStatusBar theMessage
  103.   cursor(4)
  104.   if objectp(statusWindow) then
  105.     forget(statusWindow)
  106.   end if
  107.   set statusWindow to window "status"
  108.   set h to the stageLeft + 105
  109.   set v to the stageTop + 100
  110.   set the rect of statusWindow to rect(h, v, h + 416, v + 101)
  111.   set the fileName of statusWindow to dlogdataPath & "status"
  112.   set the windowType of statusWindow to 2
  113.   set the modal of statusWindow to 1
  114.   tell statusWindow
  115.     displayMessage(theMessage)
  116.   end tell
  117.   open(statusWindow)
  118. end
  119.  
  120. on updateStatusBar thePercentage
  121.   if objectp(statusWindow) then
  122.     cursor(4)
  123.     tell statusWindow
  124.       update(thePercentage)
  125.     end tell
  126.     if thePercentage = 100 then
  127.       set the visible of statusWindow to 0
  128.       updateStage()
  129.       close(statusWindow)
  130.       forget(statusWindow)
  131.     end if
  132.   end if
  133. end
  134.  
  135. on showTheAlertBox theMessage, theAlertBoxType, action1, action2, action3
  136.   if objectp(alertWindow) then
  137.     forget(alertWindow)
  138.   end if
  139.   set alertWindow to window "alert"
  140.   set h to the stageLeft + 105
  141.   set v to the stageTop + 100
  142.   set the rect of alertWindow to rect(h, v, h + 416, v + 164)
  143.   set the fileName of alertWindow to dlogdataPath & "alert"
  144.   set the windowType of alertWindow to 2
  145.   set the modal of alertWindow to 1
  146.   tell alertWindow
  147.     show(theMessage, theAlertBoxType, action1, action2, action3)
  148.   end tell
  149.   open(alertWindow)
  150. end
  151.  
  152. on handleAlertBox theCommand
  153.   set the visible of alertWindow to 0
  154.   updateStage()
  155.   close(alertWindow)
  156.   forget(alertWindow)
  157.   do(theCommand)
  158. end
  159.  
  160. on checkString theCheckString
  161.   global fileObj
  162.   set error to 0
  163.   if not listp(theCheckString) then
  164.     set error to 1
  165.     set theMessage to "Sorry you require Big Top's Cartoon Toolbox Starring Felix the Cat to play this cartoon."
  166.     set theAlertBoxType to #OK
  167.     set btn2script to "nothing"
  168.     set btn3script to "fileObj( mDispose )"
  169.   else
  170.     if count(theCheckString) <> 3 then
  171.       set error to 1
  172.       set theMessage to "Sorry cannot import, this is an old version of toondata."
  173.       set theAlertBoxType to #OK
  174.       set btn2script to "nothing"
  175.       set btn3script to "fileObj( mDispose )"
  176.     else
  177.       if getAt(theCheckString, 1) <> 2 then
  178.         set error to 1
  179.         set theMessage to "Sorry you require Simpsons Cartoon Studio to play this cartoon."
  180.         set theAlertBoxType to #OK
  181.         set btn2script to "nothing"
  182.         set btn3script to "fileObj( mDispose )"
  183.       else
  184.         if getAt(theCheckString, 2) <> 1 then
  185.           set error to 1
  186.           set theMessage to "This cartoon was made with a foreign language or updated version of the Cartoon Studio. The cartoon will not play exactly as written: Do yo wish to continue?"
  187.           set theAlertBoxType to #cancel_ok
  188.           set btn2script to "fileObj( mDispose )"
  189.           set btn3script to "doImportToondata2(fileMgr)"
  190.         else
  191.           if getAt(theCheckString, 3) = 1 then
  192.             set error to 1
  193.             set theMessage to "This cartoon contains customized content and will not play exactly as originally written.  Do you wish to continue?"
  194.             set theAlertBoxType to #cancel_ok
  195.             set btn2script to "fileObj( mDispose )"
  196.             set btn3script to "doImportToondata2(fileMgr)"
  197.           end if
  198.         end if
  199.       end if
  200.     end if
  201.   end if
  202.   if error then
  203.     showTheAlertBox(theMessage, theAlertBoxType, "nothing", btn2script, btn3script)
  204.   else
  205.     return 1
  206.   end if
  207. end
  208.