home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / pc / files / bell.dir / 00325_Script_TelephoneParentScript < prev    next >
Text File  |  1997-05-26  |  19KB  |  559 lines

  1. -- Telephone Object Parent Script
  2. --Instantiated as gTel
  3.  
  4. property pMouthPieceTracker  -- #MOUTHPIECEON or #MOUTHPIECEOFF
  5.  
  6.  
  7. property pMouthCastList -- list of castNums for the mouthpiece sprite
  8. property pBottleCastList --list of castNums for the bottles 
  9.  
  10. property pZoomNeedleSprite -- sprite channel for the QT of the interactive needle
  11. property pLastNeedlePosition -- last position that the needle was in
  12. property pZoomNeedleCast -- cast number for the QT of the needle
  13. property pZoomNeedleH --locH of the needleQT
  14. property pZoomNeedleV --locV of the needle QT
  15.  
  16. property pMouthPieceID -- which actual mouthpiece is on the stand. It is a number from 1 to 3, or #NOMOUTHPIECE if there is nothing on there
  17. property pLiquidID -- #COD, #WAT, or #ACD
  18. property pLiquidIDList -- list of all three liquid ID's
  19. property pNeedleID -- needle position 1, 2, 3, or 4
  20.  
  21.  
  22. property pResolutionSymbol -- used to get values out of property list
  23. property pResolutionSound -- string that tell which AIF file to play for outcome sound
  24. property pResolutionHint -- string that tell which AIF file to play for hint
  25. property pResolutionNeedleDurationList -- list of QT durations for needles vibrating in solution
  26. property pCurrentResolutionNeedleStopTime --current QT duration of the vibrating needle
  27. property pResolutionNeedleSprite -- sprite of the QT vibrating needle
  28. property pResolutionVibrationDuration --duration QT of the speaker vibrating
  29. property pResolutionVibrationSprite -- sprite of the speaker vibrating
  30. property pRewardSprite -- sprite of the QT reward video with Bell
  31. property pRewardStopTime  -- duration of the QT Reward video
  32.  
  33. property pRewardList -- list of the three possible reward videos with Bell
  34. property pNumberOfTrials, pBottleQTSprite --tracks the number of times that the test button has been hit
  35.  
  36.  
  37.  
  38. ----------------<<ò>>
  39. --JOURNAL PROPS
  40. ----------------<<ò>>
  41. property pCorrectX, pCorrectY, pCorrectZ, pTestRecord
  42.  
  43.  
  44.  
  45. global gSndPath, gUtilityObj, gJournalObj, gInterfaceMgrObj
  46.  
  47.  
  48. property pQTList, pMouthSprite, pMouthCastStart, pOutcomeList, pHintList, pZoomed, pMainCursor
  49. property pBottleCapStartCast,  pBottleQTstartCast, pQTsprite, pQTbottleStage
  50. property pCurrentBottle, pCurrentMouthPiece, pBottleSprite, pNeedlePosition, pNewBottle
  51. property pSndPlaying, pWhatHintFile, pBottleQTrect, pMouthStartSprite, pBottleStartSprite
  52. property pRolloverStartsprite, pRolloverEndSprite, plabels, pOutcomeSndFile
  53.  
  54. on mInit me
  55.   
  56.   cursor 4
  57.   
  58.   
  59.   
  60.   set pBottleSprite = 16
  61.   set pMouthSprite = 15
  62.   set pQTsprite = 20
  63.   set pMouthStartSprite = 9
  64.   set pBottleStartSprite = 5
  65.   
  66.   set pBottleCapStartCast = the number of cast "BottleCap1"
  67.   set pBottleQTstartCast = the number of cast "BTECAP1b.MOV"
  68.   set pMouthCastStart =the number of cast "mouthPiece1"
  69.   set pOutcomeList = value( line 1 of the text of cast "BYS db")
  70.   set pHintList = value( line 2 of the text of cast "BYS db")
  71.   set pSndPlaying = #NONE
  72.   set pBottleQTrect = rect(157, 274, 257, 302)
  73.   
  74.   set pLiquidIDList = [#COD, #WAT, #ACD]
  75.   
  76.   
  77.   --JOURNAL PROPS
  78.   
  79.   set pCorrectX = 3
  80.   set pCorrectY = 2
  81.   set pCorrectZ = 3
  82.   
  83.   set pTestRecord = []
  84.   repeat with x = 1 to 36
  85.     add(pTestRecord, 0)
  86.   end repeat
  87.   
  88.   return me
  89. end
  90.  
  91. -------------------------------------------------------------------------------------------------------------------
  92. on mActivate me
  93.   
  94.   sound playfile 2, gSndPath & "BTEINTR.AIF"
  95.   puppetsprite pMouthSprite, true
  96.   puppetsprite pBottleSprite, true
  97.   
  98.   set pCurrentLiquid = #COD
  99.   set pNeedlePosition = 1
  100.   set pCurrentBottle = 1
  101.   set pCurrentMouthPiece = 1
  102.   set pQTbottleStage = #NOTACTIVE
  103.   
  104.   set pNumberOfTrials = 0
  105.   set pZoomed = FALSE
  106.   mInformJournal(gJournalObj, #ArrivingAtBIY)
  107.   mSetToolBtns (gInterfaceMgrObj, #BBYS, me)
  108.   
  109.   set pMainCursor = [21:#RETURN,22:#RETURN,13:#ZOOMIN,12:#Speak]
  110.   repeat with counter = pMouthStartSprite to pMouthStartSprite + 2
  111.     addprop(  pMainCursor,counter,#operate)
  112.   end repeat
  113.   repeat with counter = pBottleStartSprite to pBottleStartSprite + 2
  114.     addprop(  pMainCursor,counter,#operate)
  115.   end repeat
  116.   
  117.   mSetCursors( gUtilityObj, pMainCursor)
  118.   
  119.   mUnSetOneCursor( gUtilityObj, pMouthStartSprite + pCurrentMouthPiece - 1)
  120.   mUnSetOneCursor( gUtilityObj, pBottleStartSprite + pCurrentBottle - 1)
  121.   
  122.   mSetRollover( me, #main )
  123.   cursor -1
  124.   
  125. end
  126.  
  127. -------------------------------------------------------------------------------------------------------------------
  128. on mOperate me, whatSelection
  129.   
  130.   sound stop 1
  131.   sound stop 2
  132.   
  133.   if (whatSelection = 1) then
  134.     set MouthPiece = pCurrentMouthPiece - 1
  135.     if MouthPiece <= 0 then set MouthPiece = 3
  136.     if  pZoomed then mPullout me
  137.     mMouthPiece me, MouthPiece
  138.   else if (whatSelection = 2) then
  139.     set bottlePosition = pCurrentBottle - 1
  140.     if bottlePosition <= 0 then set bottlePosition = 3
  141.     if  pZoomed then mPullout me
  142.     mBottleClicked me, bottlePosition
  143.   else if (whatSelection = 3) then
  144.     set NewNeedle = pNeedlePosition -1
  145.     if NewNeedle <= 0 then set NewNeedle = 1
  146.     if not pZoomed then mZoomNeedle me
  147.     mSetNeedlePoint me, NewNeedle
  148.   else if (whatSelection = 4) then
  149.     set MouthPiece = pCurrentMouthPiece + 1
  150.     if MouthPiece >= 4 then set MouthPiece = 1
  151.     if  pZoomed then mPullout me
  152.     mMouthPiece me, MouthPiece
  153.   else if (whatSelection = 5) then
  154.     set bottlePosition = pCurrentBottle + 1
  155.     if bottlePosition >= 4 then set bottlePosition = 1
  156.     if  pZoomed then mPullout me
  157.     mBottleClicked me, bottlePosition
  158.   else if (whatSelection = 6) then
  159.     set NewNeedle = pNeedlePosition + 1
  160.     if NewNeedle >= 4 then set NewNeedle = 4
  161.     if not pZoomed then mZoomNeedle me
  162.     mSetNeedlePoint me, NewNeedle
  163.   else if (whatSelection = 7) then
  164.     mResolution me
  165.   end if
  166.   
  167.   mClearToolHilite (gInterfaceMgrObj)
  168.   
  169. end mOperate
  170. -------------------------------------------------------------------------------------------------------------------
  171. on mZoom me, whatSelection
  172.   
  173.   mZoomNeedle(me)
  174.   mClearToolHilite (gInterfaceMgrObj)
  175.   
  176. end mZoom
  177. -------------------------------------------------------------------------------------------------------------------
  178.  
  179. on mClose me
  180.   
  181.   puppetsprite pBottleSprite, false
  182.   puppetsprite pMouthSprite, false
  183.   puppetsprite pQTsprite, false
  184.   mInformJournal(gJournalObj, #LeavingBIY)
  185.   
  186. end mClose
  187. ----------------------------------------------------------------------
  188. on mSetRollover me, whatarea
  189.   
  190.   if whatarea = #main then
  191.     set pRolloverStartsprite = 4
  192.     set pRolloverEndSprite = 11
  193.     set plabels = the text of cast "Tele rollover text"
  194.   else if whatarea = #Needle then
  195.     set pRolloverStartsprite = 6
  196.     set pRolloverEndSprite = 10
  197.     set plabels = the text of cast "Needle Labels"
  198.   end if
  199.   
  200. end mSetRollover
  201. ----------------------------------------------------------------------
  202. on mMouthPiece me, mouthPosition
  203.   
  204.   sound stop 2
  205.   if (mouthPosition <> pCurrentMouthPiece) then
  206.     set tempcurlst = [:]
  207.     addProp (tempcurlst,(pMouthStartSprite + pCurrentMouthPiece - 1),#OPERATE)
  208.     mSetCursors( gUtilityObj, tempcurlst )
  209.     set pCurrentMouthPiece = mouthPosition
  210.     mUnSetOneCursor( gUtilityObj, pMouthStartSprite + pCurrentMouthPiece - 1)
  211.     set the castNum of sprite pMouthSprite = (pMouthCastStart - 1) + pCurrentMouthPiece
  212.     updatestage
  213.   end if
  214.   
  215. end mMouthPiece
  216. ----------------------------------------------------------------------
  217. on mBottleClicked me, bottlePosition
  218.   
  219.   if (bottlePosition <> pCurrentBottle) then
  220.     puppetsprite pQTsprite, true
  221.     set pNewBottle = bottlePosition
  222.     
  223.     set the castnum of sprite pQTsprite =  (pBottleQTstartCast - 1) + (pCurrentBottle * 2) - 1
  224.     set the rect of sprite pQTsprite = pBottleQTrect
  225.     
  226.     set pQTbottleStage = #OFF
  227.     updatestage
  228.     set the movierate of sprite pQTsprite = 1
  229.     
  230.   end if
  231.   
  232. end mBottleClicked
  233. ---------------------------------------------------------------------{}
  234.  
  235. on mPerform me
  236.   
  237.   if (pQTbottleStage <> #NOTACTIVE) then
  238.     
  239.     set mtMonitor = the movierate of sprite pQTsprite
  240.     if (pQTbottleStage = #OFF) and ( mtMonitor = 0) then
  241.       set pQTbottleStage = #ON
  242.       
  243.       set tempcurlst = [:]
  244.       addProp (tempcurlst,(pBottleStartSprite + pCurrentBottle - 1),#OPERATE)
  245.       mSetCursors( gUtilityObj, tempcurlst)
  246.       
  247.       set pCurrentBottle = pNewBottle
  248.       mUnSetOneCursor( gUtilityObj, pBottleStartSprite + pCurrentBottle - 1)
  249.       
  250.       set the castnum of sprite pQTsprite =  (pBottleQTstartCast - 1) + (pCurrentBottle * 2)
  251.       updatestage
  252.       set the movierate of sprite pQTsprite = 1
  253.     else if (pQTbottleStage = #ON) and ( mtMonitor = 0) then
  254.       set pQTbottleStage = #NOTACTIVE
  255.       set the castnum of sprite pBottleSprite = pBottleCapStartCast  - 1 + pCurrentBottle
  256.       updatestage
  257.     end if
  258.     
  259.   else 
  260.     
  261.     set spritetoCheck = pRolloverStartsprite
  262.     set found = FALSE
  263.     repeat while (not found) and (spritetoCheck <= pRolloverEndSprite)
  264.       if rollover(spritetoCheck) then
  265.         if (spritetoCheck = 4) then set labelText = line (pCurrentMouthPiece + 5) of plabels
  266.         else if spritetoCheck = (pRolloverStartsprite + pCurrentMouthPiece + 4) then 
  267.           set labelText = " "
  268.         else set labelText = line (spritetoCheck - pRolloverStartsprite + 1) of plabels
  269.         mSetLabelText( gUtilityObj, labelText)
  270.         set found = TRUE
  271.       end if
  272.       set spritetoCheck = spritetoCheck + 1
  273.     end repeat
  274.     
  275.     if not found then mSetLabelText( gUtilityObj," ")
  276.     
  277.   end if
  278.   
  279.   
  280.   go the frame
  281.   
  282. end mPerform
  283. ------------------------------------------------------------------------------------------
  284. on mNeedleRollovers me
  285.   
  286.   set spritetoCheck = pRolloverStartsprite
  287.   set found = FALSE
  288.   repeat while (not found) and (spritetoCheck <= pRolloverEndSprite)
  289.     if rollover(spritetoCheck) then
  290.       set labelText = line (spritetoCheck - pRolloverStartsprite + 1) of plabels
  291.       mSetLabelText( gUtilityObj, labelText)
  292.       set found = TRUE
  293.     end if
  294.     set spritetoCheck = spritetoCheck + 1
  295.   end repeat
  296.   if not found then mSetLabelText( gUtilityObj," ")
  297.   
  298.   go the frame
  299.   
  300. end mNeedleRollovers
  301. ------------------------------------------------------------------------------------------
  302. on mSetNeedlePoint me, NewNeedle
  303.   
  304.   sound stop 2
  305.   set pNeedlePosition = NewNeedle
  306.   go frame "T_ZOOMNEEDLE" & string( pNeedlePosition )
  307.   
  308. end
  309. ------------------------------------------------------------------------------------------
  310. on mZoomNeedle me
  311.   
  312.   mUnSetCursors ( gUtilityObj )
  313.   set NeeldleCurLst = [4:#ZoomOut,21:#RETURN,22:#RETURN]
  314.   repeat with counter = 6 to 10
  315.     addprop( NeeldleCurLst, counter,#OPERATE)
  316.   end repeat
  317.   
  318.   set pZoomed = TRUE
  319.   sound stop 2
  320.   puppetsprite pQTsprite, FALSE
  321.   mSetRollover( me, #Needle )
  322.   go frame "T_ZOOMNEEDLE" & string( pNeedlePosition )
  323.   mSetCursors ( gUtilityObj, NeeldleCurLst)
  324.   set the cursor of sprite 5 = -1
  325.   
  326. end
  327. ------------------------------------------------------------------------------------------
  328. on mResolution me
  329.   
  330.   mUpdateTestRecord( me )
  331.   mUnSetCursors ( gUtilityObj )
  332.   sound stop 2
  333.   sound stop 1
  334.   set pZoomed = TRUE
  335.   puppetsprite pQTsprite, FALSE
  336.   go frame "T_AUDIO" & pNeedlePosition
  337.   mSetCursors ( gUtilityObj, [21:#RETURN,22:#RETURN,18:#Zoomout])
  338.   sound playfile 2, gSndpath & "BTEAUD7.AIF"
  339.   updatestage
  340.   set the movierate of sprite pQTsprite = 1
  341.   
  342. end
  343. ------------------------------------------------------------------------------------------
  344. on mCheckResolutionNeedle me
  345.   
  346.   if (the movieRate of sprite pQTsprite = 0) and not(soundbusy(2)) then 
  347.     mDelay( me, 60 )
  348.     go frame "T_VIBRATION"
  349.     
  350.   else go the frame
  351.   
  352. end mCheckResolutionNeedle
  353. -----------------------------------------------------------------------------------------
  354. on mDelay me, howlong
  355.   
  356.   set endticks = the ticks + howlong
  357.   repeat while (the ticks < endticks) and not the mousedown
  358.     updatestage
  359.   end repeat
  360.   
  361. end mDelay
  362. -----------------------------------------------------------------------------------------
  363. on mPlayResolutionNeedleQT me
  364.   
  365.   set the movieRate of sprite pQTsprite = 1
  366. end
  367.  
  368. ------------------------------------------------------------------------------------------
  369. on mPlayResolutionVibrationQT me
  370.   
  371.   mUnSetCursors( gUtilityObj )
  372.   mSetCursors ( gUtilityObj, [21:#RETURN,22:#RETURN,18:#Zoomout])
  373.   set outcome = getat(getat(getat(pOutcomeList,pCurrentBottle),pCurrentMouthPiece),pNeedlePosition)
  374.   set pSndPlaying = #OUTCOME
  375.   set pOutcomeSndFile = "BTEAUD" & String( outcome - 1) & ".AIF"
  376.   
  377.   set Hint = getat(getat(getat(pHintList,pCurrentBottle),pCurrentMouthPiece),pNeedlePosition)
  378.   set pWhatHintFile = "BTEHNT" & String( Hint) & ".AIF"
  379.   
  380.   if (pOutcomeSndFile <>  "BTEAUD0.AIF") then 
  381.     sound playfile 2, gSndPath & pOutcomeSndFile
  382.     set the movierate of sprite pQTsprite = 1
  383.   end if
  384.   
  385. end mPlayResolutionVibrationQT
  386. -----------------------------------------------------------------------------------------
  387. on mCheckResolutionVibration me
  388.   
  389.   
  390.   if (pSndPlaying = #OUTCOME) and not(soundbusy(2)) then
  391.     
  392.  
  393.     set the loch of sprite  pQTsprite = -1000
  394.     updatestage
  395.     puppetsprite pQTsprite, false
  396.  
  397.     mUnSetCursors( gUtilityObj )
  398.     if (pOutcomeSndFile =  "BTEAUD7.AIF") then
  399.       if pNumberOfTrials <= 5 then set RewardFrame = "T_VID1"
  400.       else if pNumberOfTrials <= 20 then set RewardFrame = "T_VID2"
  401.       else if pNumberOfTrials >= 21 then set RewardFrame = "T_VID3"
  402.       go frame RewardFrame
  403.       mSetCursors ( gUtilityObj, [21:#RETURN,22:#RETURN])
  404.     else
  405.       sound playfile 2, gSndPath & pWhatHintFile
  406.       set pSndPlaying = #NONE
  407.     end if
  408.     
  409.   end if
  410.   
  411.   go the frame
  412.   
  413. end mCheckResolutionVibration
  414. -----------------------------------------------------------------------------------------
  415. on mPullout me
  416.   
  417.   if pZoomed then
  418.     
  419.     mUnSetCursors( gUtilityObj )
  420.     set the cursor of sprite 5 = 0
  421.     set pZoomed = FALSE
  422.     sound stop 2
  423.     go "T_MAIN"
  424.     mSetRollover( me, #Main )
  425.     mSetCursors( gUtilityObj, pMainCursor)
  426.     mUnSetOneCursor( gUtilityObj, pMouthStartSprite + pCurrentMouthPiece - 1)
  427.     mUnSetOneCursor( gUtilityObj, pBottleStartSprite + pCurrentBottle - 1)
  428.     
  429.   else
  430.     
  431.     mClose( me )
  432.     mPullOutToArea ( gScoreEventObj )
  433.     
  434.   end if
  435.   
  436. end mPullout
  437. -----------------------------------------------------------------------------------------
  438. on mContVid me
  439.   
  440.   mUnSetCursors( gUtilityObj )
  441.   go "T_MAIN"
  442.   mSetCursors( gUtilityObj, pMainCursor)
  443.   mUnSetOneCursor( gUtilityObj, pMouthStartSprite + pCurrentMouthPiece - 1)
  444.   mUnSetOneCursor( gUtilityObj, pBottleStartSprite + pCurrentBottle - 1)
  445.   
  446. end mContVid
  447. --------------------------------------------------------------------<<ò>>
  448. --                                                                     JOURNAL RELATED SCRIPTS
  449. --------------------------------------------------------------------<<ò>>
  450. on mSwitchToJournal me
  451.   
  452.   mUnSetCursors( gUtilityObj )
  453.   set the puppet of sprite pMouthSprite = 0
  454.   set the puppet of sprite pBottleSprite = 0
  455.   set the puppet of sprite pZoomNeedleSprite = 0
  456.   go frame "T_JRNL"
  457.   sound stop 1
  458.   sound stop 2
  459.   
  460. end mSwitchToJournal
  461. --------------------------------------------------------------------<<ò>>
  462. on mSwitchToBIY me
  463.   
  464.   go frame "T_MAIN"
  465.   mSetRollover( me, #Main )
  466.   mSetCursors( gUtilityObj, pMainCursor)
  467.   
  468.   mUnSetOneCursor( gUtilityObj, pMouthStartSprite + pCurrentMouthPiece - 1)
  469.   mUnSetOneCursor( gUtilityObj, pBottleStartSprite + pCurrentBottle - 1)
  470.   
  471.   set the puppet of sprite pMouthSprite = 1
  472.   set the puppet of sprite pBottleSprite = 1
  473.   
  474.   set the castnum of sprite pBottleSprite = pBottleCapStartCast  - 1 + pCurrentBottle
  475.   set the castNum of sprite pMouthSprite = (pMouthCastStart - 1) + pCurrentMouthPiece
  476.   
  477.   updateStage
  478.   
  479. end mSwitchToBIY
  480. --------------------------------------------------------------------<<ò>>
  481. on mUpdateTestRecord me
  482.   
  483.   --x is pMouthPieceID
  484.   --y is pNeedleID
  485.   
  486.   --  set pNeedlePosition = 1
  487.   --  set pCurrentBottle = 1
  488.   --  set pCurrentMouthPiece = 1
  489.   
  490.   set CurrentZ = getPos (pLiquidIDList, pLiquidID)
  491.   
  492.   set AdjustedMouthPieceID = mAdjustMouthPieceID (me, pCurrentMouthPiece)
  493.   set CurrentTestIndex = ((3 - AdjustedMouthPieceID) * 12) + ((pCurrentBottle - 1) * 4) + (pNeedlePosition)
  494.   setAt(pTestRecord, CurrentTestIndex, 1)
  495.   
  496.   
  497. end mUpdateTestRecord
  498. --------------------------------------------------------------------<<ò>>
  499. on mAdjustMouthPieceID me, argWhichMouthPiece
  500.   
  501.   --With better design, we can avoid this kind of nonsense:
  502.   
  503.   if argWhichMouthPiece = 3 then set RealMouthPieceID = 1
  504.   else if argWhichMouthPiece = 1 then set RealMouthPieceID = 3
  505.   else set RealMouthPieceID = 2
  506.   return RealMouthPieceID
  507.   
  508. end mAdjustMouthPieceID
  509. --------------------------------------------------------------------<<ò>>
  510. on mUnAdjustMouthPieceID me, argWhichMouthPiece
  511.   
  512.   
  513.   if argWhichMouthPiece = 2 then set UnAdjustedID = 2
  514.   else if argWhichMouthPiece = 3 then set UnAdjustedID = 3
  515.   else set UnAdjustedID = 1
  516.   return UnAdjustedID
  517.   
  518. end mUnAdjustMouthPieceID
  519. --------------------------------------------------------------------<<ò>>
  520. on mReviewExperiment me, argRowClicked, argCollumClicked
  521.   
  522.   
  523.   set pCurrentMouthPiece = mUnAdjustMouthPieceID (me, argCollumClicked)
  524.   set pCurrentBottle = (((argRowClicked - 1) / 4) + 1)
  525.   set pNeedlePosition = argRowClicked mod 4
  526.   if pNeedlePosition = 0 then set pNeedlePosition = 4
  527.   
  528.   mResolution me
  529.   
  530. end mReviewExperiment
  531. --------------------------------------------------------------------<<ò>>
  532. on mDiscloseCorrectX me
  533.   
  534.   --set AdjustedCorrectMouthPiece = mAdjustMouthPieceID (me, pCorrectX)
  535.   
  536.   return ( 354 )
  537.   
  538. end mDiscloseCorrectX
  539. --------------------------------------------------------------------<<ò>>
  540. on mDiscloseCorrectY me
  541.   
  542.   return (370)
  543.   
  544. end mDiscloseCorrectY
  545. --------------------------------------------------------------------<<ò>>
  546. on mDiscloseCorrectZ me
  547.   
  548.   return pCorrectZ
  549.   
  550. end mDiscloseCorrectZ
  551. --------------------------------------------------------------------<<ò>>
  552. on mDiscloseTestRecord me
  553.   
  554.   return pTestRecord
  555.   
  556. end mDiscloseTestRecord
  557. --------------------------------------------------------------------<<ò>>
  558.  
  559.