home *** CD-ROM | disk | FTP | other *** search
/ Comic Book Maker: The Smurfs / COMIC.iso / mac / data_m / dialog / 00001_DialogScripts.ls next >
Encoding:
Text File  |  1999-07-07  |  5.6 KB  |  201 lines

  1. property continueHandler, continueObj, defaultBtn, defaultCancelBtn
  2. global gDialogPresent, gObj3, gObj2, gObj5, gPlatForm
  3.  
  4. on startMovie
  5. end
  6.  
  7. on st
  8.   set theStr to EMPTY
  9.   repeat with i = 1 to 255
  10.     put numToChar(i) after theStr
  11.   end repeat
  12.   put theStr
  13. end
  14.  
  15. on promptToOverwrite me, theSprite, state
  16.   if state then
  17.     puppetSound(1, "alertSnd")
  18.   end if
  19.   repeat with i = 26 to 33
  20.     set the locV of sprite i to the locV of sprite i - (((state * 2) - 1) * 300)
  21.   end repeat
  22.   if state then
  23.     set the rect of sprite 25 to the rect of sprite 2
  24.   else
  25.     set the locH of sprite 25 to 9000
  26.   end if
  27.   set the editableText of sprite 23 to abs(state - 1)
  28.   updateStage()
  29. end
  30.  
  31. on displayDialog num, param1, param2, param3
  32.   tell the stage
  33.     set the idleHandlerPeriod to 9999
  34.   end tell
  35.   set the idleHandlerPeriod to 0
  36.   set the cpuHogTicks to 0
  37.   set gDialogPresent to num
  38.   cursor(0)
  39.   case num of
  40.     9:
  41.       set the text of member "directoryIndex" to the pDataFileDirectoryContents of gObj5
  42.       set the textHeight of member "directoryIndex" to 15
  43.     10:
  44.       set the text of member "directoryIndex2" to the pDataFileDirectoryContents of gObj5
  45.       set the textHeight of member "directoryIndex2" to 15
  46.       if the pCurrentFileName of gObj5 = 0 then
  47.         set the text of member "fileName" to the pDefaultFileName of gObj5
  48.       else
  49.         set the text of member "fileName" to the pCurrentFileName of gObj5
  50.       end if
  51.     20:
  52.       set the text of member "theTitle" to param1
  53.       set the text of member "theName" to param2
  54.   end case
  55.   if num > 20 then
  56.     prepareDlog(gObj3, num - 20, param1, param2, param3)
  57.   else
  58.     set the continueHandler of script "DialogScripts" to param1
  59.     set the continueObj of script "DialogScripts" to param2
  60.   end if
  61.   if getOne([2, 3, 4, 7, 8, 12, 13, 14, 16], num) then
  62.     preloadMember("alertSnd")
  63.     puppetSound(1, "alertSnd")
  64.   else
  65.     if num = 15 then
  66.       puppetSound(1, "testSnd")
  67.     end if
  68.   end if
  69.   preLoad(num, num)
  70.   go(num)
  71.   if (num = 12) or (num = 13) then
  72.     set the myParams of sprite(4) to param1
  73.   end if
  74. end
  75.  
  76. on terminateDialog me, returnMessage, whichObj, param1
  77.   tell the stage
  78.     set the idleHandlerPeriod to 0
  79.   end tell
  80.   set the idleHandlerPeriod to 9999
  81.   set the cpuHogTicks to 9999
  82.   set the visible of sprite 20 to 1
  83.   set the modal of the activeWindow to 0
  84.   set the visible of the activeWindow to 0
  85.   go(#loop)
  86.   tell the stage
  87.     set the stageColor to the stageColor
  88.   end tell
  89.   set the keyDownScript to EMPTY
  90.   case returnMessage of
  91.     #editText:
  92.       set balloonType to gDialogPresent - 20
  93.       set param1 to duplicate(getAt(getAt(getAt(the allBalloonInfoList of gObj3, balloonType), the cBalloonTypeSize of gObj3), 1))
  94.       addAt(param1, 1, getPropAt(getAt(the allBalloonInfoList of gObj3, balloonType), the cBalloonTypeSize of gObj3))
  95.       add(param1, [the cBalloonString of gObj3, the text of member (balloonType + 70)])
  96.       set param2 to the cBalloonTypeSize of gObj3
  97.     #Cancel:
  98.       set returnMessage to 0
  99.     #continueHandler:
  100.       if not continueHandler then
  101.         alert("Error: no continueHandler present!")
  102.       end if
  103.       set returnMessage to continueHandler
  104.       set whichObj to continueObj
  105.     #saveFile:
  106.       if not (gDialogPresent = 7) then
  107.         set param1 to the text of member "fileName"
  108.       end if
  109.       set param2 to continueHandler
  110.       set param3 to continueObj
  111.     #editTitleAndName:
  112.       set param1 to the text of member "theTitle"
  113.       set param2 to the text of member "theName"
  114.   end case
  115.   set defaultBtn to 0
  116.   set defaultCancelBtn to 0
  117.   set gDialogPresent to 0
  118.   set continueHandler to 0
  119.   set continueObj to 0
  120.   if returnMessage = 0 then
  121.     exit
  122.   end if
  123.   if whichObj = #none then
  124.     tell the stage
  125.       call(returnMessage, script 1, 1, param1, param2, param3)
  126.     end tell
  127.   else
  128.     tell the stage
  129.       call(returnMessage, whichObj, 1, param1, param2, param3)
  130.     end tell
  131.   end if
  132. end
  133.  
  134. on handleDefaultKeyDown me, force
  135.   if defaultBtn and ((the key = RETURN) or (the key = ENTER) or force) then
  136.     mouseDown(sprite(defaultBtn))
  137.     set x to the ticks + 5
  138.     repeat while the ticks < x
  139.     end repeat
  140.     mouseUp(sprite(defaultBtn))
  141.     stopEvent()
  142.   else
  143.     set keyNum to charToNum(the key)
  144.     if keyNum < 5 then
  145.       stopEvent()
  146.     else
  147.       pass()
  148.     end if
  149.   end if
  150. end
  151.  
  152. on modKeyPressed
  153.   if gPlatForm then
  154.     return the commandDown
  155.   else
  156.     return the controlDown
  157.   end if
  158. end
  159.  
  160. on checkBtnLocations dialogBottom, buttonList
  161.   if voidp(buttonList) then
  162.     set buttonList to []
  163.     repeat with i = 1 to 3
  164.       if the memberNum of sprite ((i * 2) + 2) then
  165.         add(buttonList, (i * 2) + 2)
  166.       end if
  167.     end repeat
  168.   end if
  169.   repeat with i in buttonList
  170.     set textSprite to i - 1
  171.     set the locV of sprite i to dialogBottom - 50
  172.     set the locV of sprite textSprite to dialogBottom - 53 + the height of the member of sprite i
  173.     set the locH of sprite textSprite to the locH of sprite i - (the width of the member of sprite textSprite / 2) + 10
  174.   end repeat
  175. end
  176.  
  177. on Del t
  178.   set x to the ticks + t
  179.   repeat while the ticks < x
  180.   end repeat
  181. end
  182.  
  183. on zetup
  184.   repeat with i = 2 to the lastFrame
  185.     go(i)
  186.     if the memberNum of sprite 1 then
  187.       repeat with q = 1 to 3
  188.         set btnSprite to (q * 2) + 2
  189.         if the memberNum of sprite btnSprite then
  190.           beginRecording()
  191.           set the locV of sprite btnSprite to the locV of sprite 1 - 10
  192.           if the memberNum of sprite (btnSprite - 1) then
  193.             set the locV of sprite (btnSprite - 1) to the locV of sprite 1 + 9
  194.           end if
  195.           endRecording()
  196.         end if
  197.       end repeat
  198.     end if
  199.   end repeat
  200. end
  201.