home *** CD-ROM | disk | FTP | other *** search
/ Webster's Millennium Amer…Sign Language Dictionary / ASL.ISO / mac / SKILLS.dir / 00012_Script_12 < prev    next >
Text File  |  2001-09-05  |  13KB  |  389 lines

  1. on concSignSetUp
  2.   global SignList,WordList,FlippedWord,FlippedSign,NumPlayers,player,gDownLoads
  3.   global signCast,WordCast
  4.   global gWordList,gDataSource,gHistoryData,reviewListing,scrollList,gGameCat
  5.   global gMatchList,gNumTries
  6.   global p1Correct,p2Correct
  7.   global bad,myAlertWindow
  8.   global gCurrentUser,gSkipMe
  9.   
  10.   if gSkipMe = 1 then set gSkipMe = gSkipMe + 1
  11.   
  12.   if numPlayers = 1 then
  13.     put "Score:" into field "p1 title" 
  14.     put "Time:" into field "p1 score" 
  15.     put 0 into field "p2 title" 
  16.     put "0:00" into field "p2 score" 
  17.   else
  18.     put "Player 1" into field "p1 title" 
  19.     put "0" into field "p1 score" 
  20.     put "Player 2" into field "p2 title" 
  21.     put "0" into field "p2 score" 
  22.     set p1Correct = []
  23.     set p2Correct = []
  24.   end if
  25.   
  26.   updateStage
  27.   
  28.   set SignList = []
  29.   set gMatchList = []
  30.   set bad = []
  31.   set gNumTries = 0
  32.   cursor 4
  33.   --alertBox "Preparing Game..."
  34.   if gDataSource = "entire dictionary" then
  35.     repeat while count(SignList) < 12
  36.       set newSign = random(count(gWordList))
  37.       if not goodMedia(newSign) then next repeat
  38.       if getPos(SignList,newSign) = 0 then append SignList, newSign
  39.     end repeat
  40.   else if gDataSource = "category" and not (gGameCat="") then
  41.     
  42.     if gGameCat = "DownLoaded Signs" then 
  43.       put gDownLoads into catWords  
  44.       
  45.     else
  46.       
  47.       --PETEMACK 09.05.01
  48.       --      tell window "dData" to put the number of cast (gGameCat&"."&gCurrentUser) into userCat
  49.       --      if userCat > 0 then 
  50.       --        tell window "dData" to put field (gGameCat&"."&gCurrentUser) into catWords
  51.       --      else tell window "dData" to put field gGameCat into catWords
  52.       
  53.       
  54.       set vRandomPick = random(29) --PETEMACK 09.05.01
  55.       set vRandomPick = vRandomPick + 30 --PETEMACK 09.05.01
  56.       tell window "dData" to set vCatName = the name of member vRandomPick --PETEMACK 09.05.01
  57.       if gSkipMe = 2 then --PETEMACK 09.05.01
  58.         alert string(QUOTE & vCatName & QUOTE && "Category Randomly Selected") --PETEMACK 09.05.01
  59.         set gSkipMe = 0 --PETEMACK 09.05.01
  60.       end if --PETEMACK 09.05.01
  61.       tell window "dData" to put field vRandomPick into catWords --PETEMACK 09.05.01
  62.       
  63.     end if
  64.     
  65.     set catList = getStringToList(catWords)
  66.     repeat while count(SignList) < 12 and count(SignList) < count(catList)-count(bad)
  67.       set aWord = getAt(catList,random(count(catList)))
  68.       set newSign = getPos(gWordList,aWord)
  69.       if not goodMedia(newSign) then
  70.         if getPos(bad,aWord) = 0 then add bad, aWord
  71.         next repeat
  72.       end if
  73.       if getPos(SignList,newSign) = 0 then append SignList, newSign
  74.     end repeat
  75.   else if gDataSource = "all sessions" or gDataSource = "recent session" then
  76.     repeat while count(SignList) < 12 and count(SignList) < count(gHistoryData)-count(bad)
  77.       set aWord = getAt(gHistoryData,random(count(gHistoryData)))
  78.       set newSign = getPos(gWordList,aWord)
  79.       if not goodMedia(newSign) then
  80.         if getPos(bad,aWord) = 0 then add bad, aWord
  81.         next repeat
  82.       end if
  83.       if getPos(SignList,newSign) = 0 then append SignList, newSign
  84.     end repeat
  85.   else
  86.     repeat while count(SignList) < 12 and count(SignList) < count(gHistoryData)-count(bad)
  87.       set aWord = getAt(gHistoryData,random(count(gHistoryData)))
  88.       set newSign = getPos(gWordList,aWord)
  89.       if not goodMedia(newSign) then
  90.         if getPos(bad,aWord) = 0 then add bad, aWord
  91.         next repeat
  92.       end if
  93.       if getPos(SignList,newSign) = 0 then append SignList, newSign
  94.     end repeat
  95.   end if
  96.   
  97.   if count(SignList) < 12 then
  98.     repeat while count(SignList) < 12
  99.       set newSign = random(count(gWordList))
  100.       if not goodMedia(newSign) then next repeat
  101.       if getPos(SignList,newSign) = 0 then append SignList, newSign
  102.     end repeat
  103.   end if
  104.   
  105.   set WordList = scramble(SignList)
  106.   set FlippedWord = 0
  107.   set FlippedSign = 0
  108.   --put "0" into field "p1 score" 
  109.   --put "0" into field "p2 score" 
  110.   --  if numPlayers = 1 then
  111.   --    put "Score:" into field "p1 title" 
  112.   --    put "Time:" into field "p1 score" 
  113.   --    put 0 into field "p2 title" 
  114.   --    put "0:00" into field "p2 score" 
  115.   --  else
  116.   --    put "Player 1" into field "p1 title" 
  117.   --    put "0" into field "p1 score" 
  118.   --    put "Player 2" into field "p2 title" 
  119.   --    put "0" into field "p2 score" 
  120.   --    set p1Correct = []
  121.   --    set p2Correct = []
  122.   --  end if
  123.   --set NumPlayers = 2
  124.   
  125.   puppetSprite 34,true --designate player bBox
  126.   puppetSprite 36,true --cleanUp QT rect box
  127.   
  128.   set player = 0
  129.   setPlayer
  130.   
  131.   repeat with i = 3 to 26
  132.     puppetSprite i, false
  133.   end repeat
  134.   updatestage
  135.   
  136.   repeat with i = 3 to 26
  137.     puppetSprite i, true
  138.   end repeat
  139.   updatestage
  140.   
  141.   set SignCast = 0
  142.   set WordCast = 0
  143.   enableMenu(TRUE)
  144.   --  close myAlertWindow
  145.   --  forget myAlertWindow
  146.   updateStage
  147.   cursor 0
  148. end concSignSetUp
  149.  
  150. on ConcSigns
  151.   global signList,gWordList,gDownloads
  152.   repeat with i = 1 to count(SignList)
  153.     put getAt(gWordList,getAt(signlist,i)) && (gDownloads contains getAt(gWordList,getAt(signlist,i)))
  154.   end repeat
  155. end
  156.  
  157. on scramble TheList
  158.   put false into finished
  159.   set testList = []
  160.   set returnList = []
  161.   set returnvals = ""
  162.   repeat while not finished
  163.     set nextVal = random(count(theList))
  164.     if getPos(testList,nextVal) = 0 then
  165.       append returnList, getAt(TheList,nextVal)
  166.       append testList,nextVal
  167.     end if
  168.     if count(returnList) = 12 then set finished = true
  169.   end repeat
  170.   return returnList
  171. end scramble
  172.  
  173. on setPlayer
  174.   global player,NumPlayers
  175.   if numPlayers = 2 then
  176.     if player = 1 then
  177.       set player = 2
  178.       set the rect of sprite 34 = rect(316, 431, 416, 452) --p2
  179.     else  
  180.       set player = 1
  181.       set the rect of sprite 34 = rect(223, 431, 315, 452) --p1
  182.     end if
  183.   else
  184.     set the rect of sprite 34 = rect(-10,-10,0,0)
  185.   end if
  186.   updatestage
  187. end setPlayer
  188.  
  189. -- NumToChar(65) = "A"
  190. -- NumToChar(97) = "a"
  191.  
  192. on SignFlip
  193.   global SignList,WordList,FlippedWord,FlippedSign
  194.   put the clickon-2 into spNum
  195.   
  196.   if the type of sprite (spNum+2) = #digitalVideo then -- 16 is video
  197.     setSign
  198.     exit
  199.   end if
  200.   
  201.   if the type of sprite (spNum+2) = #text then -- 7 is text
  202.     setWord
  203.     exit
  204.   end if
  205.   
  206.   if spNum < 7 or (spNum >12 and spNum <19) then
  207.     if spNum mod 2 = 0 then set signRef = getAt(WordList,integer(spNum/2))
  208.     else set signRef = getAt(SignList,integer(spNum/2)+1)
  209.   else
  210.     if spNum mod 2 = 0 then set signRef = getAt(SignList,integer(spNum/2))
  211.     else set signRef = getAt(WordList,integer(spNum/2)+1)
  212.   end if
  213.   
  214.   if spNum < 7 or (spNum >12 and spNum <19) then
  215.     if spNum mod 2 = 0 then setWord signRef,spNum,"on"
  216.     else setSign signRef,spNum,"on"
  217.   else
  218.     if spNum mod 2 = 0 then setSign signRef,spNum,"on"
  219.     else setWord signRef,spNum,"on"
  220.   end if
  221.   updatestage
  222.   
  223.   checkMatch
  224.   --put getAt(gWordList,signRef)
  225.   updatestage
  226. end SignFlip
  227.  
  228. on setWord CastRef, SRef, state
  229.   global FlippedWord,FlippedSign,WordCast,gWordList
  230.   if state = "on" then
  231.     if not (FlippedWord = 0) then 
  232.       set the castNum of sprite FlippedWord+2 = 555+FlippedWord 
  233.       set locOffset = (the width of cast (555+FlippedWord))/2
  234.       set l = the locH of sprite (FlippedWord+2) + 5
  235.       set the locH of sprite (FlippedWord+2) to l+integer(locOffset)
  236.       set the locV of sprite (FlippedWord+2) = (the locV of sprite (FlippedWord+2) + 5)
  237.       updatestage
  238.       --put "flipping back"
  239.     end if
  240.     --tell window "dData" to put the name of cast (castRef+5000) into wordName
  241.     put getAt(gWordList,castRef) into field "wordText"
  242.     set l = the left of sprite(sRef+2)
  243.     set c = (the top of sprite (sRef+2) + the bottom of sprite (sRef+2))/2
  244.     ---ïïï
  245.     set the loch of sprite 2 to the loch of sprite the clickon
  246.     set the locv of sprite 2 to the locv of sprite the clickon
  247.     ---ïïï
  248.     set the castNum of sprite (sRef+2) to the number of cast "wordText"
  249.     set the ink of sprite (sRef+2) to 36
  250.     set the loch of sprite (sRef+2) to l - 5 
  251.     set the locv of sprite (sRef+2) to c - 5
  252.     --put sref
  253.     set WordCast = castRef
  254.     set FlippedWord = SRef
  255.     --put "on"
  256.   else
  257.     --put "off"
  258.     set the castNum of sprite FlippedWord+2 = 555+FlippedWord 
  259.     set locOffset = (the width of cast (555+FlippedWord))/2
  260.     set l = the locH of sprite (FlippedWord+2)
  261.     set the locH of sprite (FlippedWord+2) to l+integer(locOffset)
  262.     set FlippedWord = 0
  263.   end if
  264.   updatestage
  265. end setWord
  266.  
  267. on setSign CastRef, SRef, state
  268.   global FlippedWord,FlippedSign,SignCast
  269.   if state = "on" then
  270.     if not (FlippedSign = 0) then 
  271.       set the castNum of sprite FlippedSign+2 = 555+FlippedSign 
  272.       set the width of sprite (FlippedSign+2) to the width of cast (555+FlippedSign)
  273.       set the height of sprite (FlippedSign+2) to the height of cast (555+FlippedSign)
  274.       updatestage
  275.     end if
  276.     videoSetUp CastRef,SRef
  277.     set signCast = CastRef
  278.     set FlippedSign = SRef
  279.   else
  280.     set the castNum of sprite FlippedSign+2 = 555+FlippedSign  
  281.     set the width of sprite (FlippedSign+2) to the width of cast (555+FlippedSign)
  282.     set the height of sprite (FlippedSign+2) to the height of cast (555+FlippedSign)
  283.     set FlippedSign = 0
  284.   end if
  285.   updatestage
  286. end setSign
  287.  
  288. on videoSetUp castRef,SRef
  289.   global gSoundOn
  290.   global videoFile,gWordList
  291.   cursor 4
  292.   tell window "dData" to put the text of cast getAt(gWordList,castRef) into DictEntry
  293.   --tell window "dData" to put the text of cast (castRef+5000) into DictEntry
  294.   set the itemDelimiter to "*"
  295.   
  296.   put item 5 of DictEntry into qtRef
  297.   put item 6 of DictEntry into pictRef
  298.   put item 11 of DictEntry into field "hint"
  299.   set videoFile = getName(qtRef,"MOVS")
  300.   
  301.   put char 1 to (length(item 8 of DictEntry)-3) of item 8 of DictEntry&"aif" into descSnd
  302.   if the machineType = 256 then
  303.     set descFile = getName(descSnd,"snds/Desc") --snd expl
  304.   else set descFile = getName(descSnd,"snds:Desc") --snd expl
  305.   
  306.   sound stop 3
  307.   if not (the filename of cast "sound desc" = descFile) then
  308.     set the filename of cast "sound desc" = descFile
  309.   end if
  310.   
  311.   set the filename of cast "video" to videoFile
  312.   set the itemDelimiter to ","
  313.   set the movierate of sprite 40 = 0
  314.   
  315.   if gSoundOn then  
  316.     sound playfile 3, the filename of cast "sound desc"
  317.   end if
  318.   set the directToStage of cast "video" to true
  319.   set the loop of cast "video" to true
  320.   set the castNum of sprite (SRef+2) to the number of cast "video"
  321.   set w = the width of cast "video"
  322.   set h = the height of cast "video"
  323.   set the width of sprite (SRef+2) to integer(w/2.0) --2.5
  324.   set the height of sprite (SRef+2) to integer(h/2.0)
  325.   
  326.   
  327.   --put the rect of sprite (SRef+2)
  328.   --set the movierate of sprite 40 to 1
  329.   cursor 0
  330. end videoSetUp
  331.  
  332. on checkMatch
  333.   global FlippedWord,FlippedSign,NumPlayers,player,p1Correct,p2Correct
  334.   global signCast,WordCast,gMatchList,gNumTries,gClockOn
  335.   
  336.   if not (FlippedWord = 0 or FlippedSign = 0) then
  337.     if SignCast = WordCast then
  338.       add gMatchList, WordCast
  339.       if NumPlayers = 2 then
  340.         if player = 1 then
  341.           --
  342.           add p1Correct, WordCast
  343.           --
  344.         else
  345.           --
  346.           add p2Correct, WordCast
  347.           --
  348.         end if
  349.       end if
  350.       repeat with i = 1 to 10000
  351.         if the mouseDown then exit repeat
  352.       end repeat
  353.       set fWordTemp = flippedWord
  354.       set fSignTemp = flippedSign
  355.       
  356.       setWord
  357.       setSign
  358.       updatestage
  359.       set the loch of sprite 2 to -100
  360.       set the loch of sprite fWordTemp+2 to -100
  361.       set the loch of sprite fSignTemp+2 to -100
  362.       
  363.       set FlippedSign = 0
  364.       set FlippedWord = 0
  365.       updatescore
  366.     else
  367.       if NumPlayers = 2 then setPlayer --2
  368.     end if
  369.     if count(gMatchList) = 12 then 
  370.       saveResults
  371.       set gClockOn = false
  372.       mouseUp (script "summary script")
  373.     end if
  374.   end if
  375.   set gNumTries = gNumTries+1
  376. end checkMatch
  377.  
  378. on updatescore3
  379.   global player,NumPlayers
  380.   if NumPlayers = 2 then
  381.     if player = 1 then
  382.       put string(integer(field "p1 score")+1) into field "p1 score"
  383.     else
  384.       put string(integer(field "p2 score")+1) into field "p2 score"
  385.     end if
  386.   else
  387.     put string(integer(field "p2 title")+1) into field "p2 title"
  388.   end if
  389. end updatescore