home *** CD-ROM | disk | FTP | other *** search
/ Oz - The Magical Adventure / Adventure.iso / pc / dkdata / juice.dxr / Internal_39_setGameJuice.ls < prev    next >
Encoding:
Text File  |  2000-06-01  |  2.0 KB  |  66 lines

  1. on setGameJuice
  2.   global gGameSol, gFrameCounter, gNumberOfMovesLeft, gMasterMoves, gGameState, gDifficultyLevel, gInactivities
  3.   gFrameCounter = 0
  4.   gGameSol = EMPTY
  5.   TEMP = "123"
  6.   gMasterMoves = EMPTY
  7.   theOrder = "123"
  8.   if (gDifficultyLevel <> 1) and (random(10) > 5) then
  9.     theOrder = "213"
  10.   end if
  11.   case gDifficultyLevel of
  12.     1:
  13.       maxUnits = 5
  14.       repeat with i = 1 to 3
  15.         put random(maxUnits) into item i of gGameSol
  16.       end repeat
  17.       put gGameSol into field "tempStore"
  18.     2:
  19.       maxUnits = 5
  20.       baseVal = 1 + random(maxUnits)
  21.       repeat with i = 1 to 3
  22.         put baseVal into item i of gGameSol
  23.       end repeat
  24.       if theOrder = "123" then
  25.         whichGame = value(GetResponse(1, "123456"))
  26.         myGame = item whichGame of "102,120,112,110,121,101"
  27.       else
  28.         whichGame = value(GetResponse(2, "123456"))
  29.         myGame = item whichGame of "011,012,210,211,110,112"
  30.       end if
  31.       repeat with i = 1 to 3
  32.         newVal = value(item i of gGameSol) + value(char i of myGame)
  33.         put newVal into item i of gGameSol
  34.       end repeat
  35.       put gGameSol into field "tempStore"
  36.     otherwise:
  37.       theRatio = item random(10) of "122,221,212,112,121,211,124,214,421,241"
  38.       case theRatio of
  39.         "122", "221", "212", "112", "121", "211":
  40.           factor = value(char random(2) of "24")
  41.         "124", "214", "421", "241":
  42.           factor = random(2)
  43.       end case
  44.   end case
  45.   if gDifficultyLevel = 3 then
  46.     repeat with i = 1 to 3
  47.       put value(char i of theRatio) * factor into item i of gGameSol
  48.     end repeat
  49.   end if
  50.   put theOrder into item 4 of gGameSol
  51.   put gGameSol into field "tempStore"
  52.   set the textStyle of field "tempStore" to "plain"
  53.   if gDifficultyLevel = 3 then
  54.     set the textStyle of item value(item 1 of gMasterMoves) of field "tempStore" to "bold"
  55.     TEMP = field("tempStore")
  56.   end if
  57.   gGameState = "0,0,0," & theOrder
  58.   SaytheMixture()
  59.   if gDifficultyLevel = 2 then
  60.     go("load")
  61.   end if
  62.   set the timeoutLength to 5 * 60
  63.   set the timeoutScript to "JuiceInactivity"
  64.   gInactivities = VOID
  65. end
  66.