home *** CD-ROM | disk | FTP | other *** search
/ Iona Software Demo / MacWin_IonaSoftware_DemoCD.iso / pc / muppets / btr / tsp03b.dir / 00067.ls < prev    next >
Encoding:
Text File  |  1996-02-23  |  3.0 KB  |  125 lines

  1. global objSpr, choice1Spr, choice2Spr, rtAnsList, curEx, numEx, orgColor, showAns, piggy, fozzie, hilite
  2.  
  3. on startMovie
  4.   set hilite to 207
  5.   set curEx to 0
  6.   set numEx to 5
  7.   set numItems to 8
  8.   set showAns to 0
  9.   set piggy to 3
  10.   set fozzie to 4
  11.   set objSpr to 5
  12.   set choice1Spr to 6
  13.   set choice2Spr to 7
  14.   set itemList to []
  15.   repeat with i = 1 to numItems
  16.     addAt(itemList, random(i), i - 1)
  17.   end repeat
  18.   set rtAnsList to []
  19.   repeat with i = 1 to numEx
  20.     addAt(rtAnsList, random(i), getAt(itemList, i))
  21.   end repeat
  22. end
  23.  
  24. on SetupEx
  25.   global rtChoice, objSpr, choice1Spr, choice2Spr, rtAnsList, curEx, numEx
  26.   set curEx to curEx + 1
  27.   if curEx >= numEx then
  28.     tell the stage
  29.       NextPage()
  30.     end tell
  31.     abort()
  32.   end if
  33.   puppetSprite(objSpr, 1)
  34.   puppetSprite(choice1Spr, 1)
  35.   puppetSprite(choice2Spr, 1)
  36.   set rtAns to getAt(rtAnsList, curEx)
  37.   set the castNum of sprite objSpr to the number of cast "radio" + rtAns
  38.   set rtLetter to the number of cast "r" + rtAns
  39.   if random(2) = 1 then
  40.     set rtChoice to choice1Spr
  41.     set wrChoice to choice2Spr
  42.   else
  43.     set rtChoice to choice2Spr
  44.     set wrChoice to choice1Spr
  45.   end if
  46.   set the castNum of sprite rtChoice to rtLetter
  47.   set the castNum of sprite wrChoice to rtLetter
  48.   repeat while the castNum of sprite wrChoice = rtLetter
  49.     set Ltr to the number of cast "r" - 1 + random(15)
  50.     if (rtLetter = 52) and (Ltr = 49) then
  51.       set Ltr to rtLetter
  52.     end if
  53.     if (rtLetter = 55) and (Ltr = 50) then
  54.       set Ltr to rtLetter
  55.     end if
  56.     set the castNum of sprite wrChoice to Ltr
  57.   end repeat
  58.   set orgColor to the foreColor of sprite rtChoice
  59.   puppetSprite(objSpr, 0)
  60.   puppetSprite(choice1Spr, 0)
  61.   puppetSprite(choice2Spr, 0)
  62. end
  63.  
  64. on pick1
  65.   global rtChoice, choice1Spr
  66.   set the foreColor of sprite choice1Spr to hilite
  67.   if rtChoice = choice1Spr then
  68.     go("rightAns")
  69.   else
  70.     go("wrongAnsPiggy")
  71.   end if
  72. end
  73.  
  74. on pick2
  75.   global rtChoice, choice2Spr
  76.   set the foreColor of sprite choice2Spr to hilite
  77.   if rtChoice = choice2Spr then
  78.     go("rightAns")
  79.   else
  80.     go("wrongAnsFozzie")
  81.   end if
  82. end
  83.  
  84. on SHowAnswer
  85.   global rtChoice, showAns
  86.   vwSayName(rtChoice)
  87.   repeat with i = 1 to 3
  88.     set the foreColor of sprite rtChoice to hilite
  89.     updateStage()
  90.     startTimer()
  91.     repeat while the timer < 12
  92.     end repeat
  93.     set the foreColor of sprite rtChoice to orgColor
  94.     updateStage()
  95.     startTimer()
  96.     repeat while the timer < 12
  97.     end repeat
  98.   end repeat
  99.   vwSayName(objSpr)
  100.   shFLASH(objSpr, 12, 4)
  101.   set showAns to 1
  102.   go("rightAns")
  103. end
  104.  
  105. on P3LegalButton sprNum, func, hiLiteThis, rollover2
  106.   set originColor to the foreColor of sprite hiLiteThis
  107.   set doIt to 0
  108.   repeat while the stillDown
  109.     if rollOver(sprNum) or rollOver(rollover2) then
  110.       set the foreColor of sprite hiLiteThis to hilite
  111.       updateStage()
  112.       set doIt to 1
  113.       next repeat
  114.     end if
  115.     set the foreColor of sprite hiLiteThis to originColor
  116.     updateStage()
  117.     set doIt to 0
  118.   end repeat
  119.   set the foreColor of sprite hiLiteThis to originColor
  120.   vwWaitForSound()
  121.   if doIt then
  122.     do(func)
  123.   end if
  124. end
  125.