home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / AgnesSorel.dxr / 00055.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  10.6 KB  |  250 lines

  1. property spriteNum
  2.  
  3. on beginSprite me
  4.   global scount, tcount, stock, tableau, firstSprite, everyOk
  5.   sprite(me.spriteNum).visible = 1
  6.   if scount = 1 then
  7.     tableau.addProp(symbol(string(sprite(me.spriteNum).startFrame)), new(script("tableau"), [:]))
  8.     firstSprite.add(me.spriteNum)
  9.   end if
  10.   if scount = 1 then
  11.     if tcount = 1 then
  12.       sprite(me.spriteNum).loc = point(98, 182)
  13.     else
  14.       sprite(me.spriteNum).loc = sprite(me.spriteNum - 20).loc + point(sprite(me.spriteNum).width + 12, 0)
  15.     end if
  16.   else
  17.     sprite(me.spriteNum).loc = sprite(me.spriteNum - 1).loc + point(0, sprite(me.spriteNum).height / 3)
  18.   end if
  19.   sprite(me.spriteNum).member = stock.cards[1].rank & "_" & stock.cards[1].suit
  20.   stock.cards.deleteAt(1)
  21.   tableau[string(sprite(me.spriteNum).startFrame).symbol].addcards(symbol(string(me.spriteNum)), new(script("card"), me.spriteNum))
  22.   if scount > tcount then
  23.     sprite(me.spriteNum).visible = 0
  24.     stock.cards.add(tableau[string(sprite(me.spriteNum).startFrame).symbol].cards[symbol(string(me.spriteNum))])
  25.     tableau[string(sprite(me.spriteNum).startFrame).symbol].substractcards(symbol(string(me.spriteNum)))
  26.   end if
  27.   if scount = 20 then
  28.     tcount = tcount + 1
  29.     scount = 0
  30.   end if
  31.   puppetSound(3, "deal1")
  32.   scount = scount + 1
  33.   if tableau.count = 7 then
  34.     everyOk = 1
  35.   else
  36.     everyOk = 0
  37.   end if
  38. end
  39.  
  40. on mouseDown me
  41.   global tableau, sha
  42.   puppetSound(3, "pickcard")
  43.   if sprite(me.spriteNum).visible = 1 then
  44.     if tableau[string(sprite(me.spriteNum).startFrame).symbol].cards[string(me.spriteNum).symbol].membername = tableau[string(sprite(me.spriteNum).startFrame).symbol].cards[tableau[string(sprite(me.spriteNum).startFrame).symbol].cards.count].membername then
  45.       if sprite(me.spriteNum).visible = 1 then
  46.         sprite(me.spriteNum).loc = the mouseLoc
  47.         sprite(me.spriteNum).moveableSprite = 1
  48.         sprite(me.spriteNum).locZ = 1000
  49.         sha = []
  50.       end if
  51.     else
  52.       checkpilepos(me.spriteNum)
  53.     end if
  54.   end if
  55. end
  56.  
  57. on mouseUp me
  58.   global equal_value, hots, garbage, points, foundation, stock, stockPile, tableau, id, hots2, sha, hotti, equalvalue2
  59.   the actorList = []
  60.   if sha.count = 0 then
  61.     if sprite(me.spriteNum).moveableSprite = 1 then
  62.       if equal_value = 1 then
  63.         if sha.count = 0 then
  64.           checkfound(me.spriteNum)
  65.           puppetSound(3, "pickcard")
  66.         end if
  67.       else
  68.         if equalvalue2 = 1 then
  69.           checktab(me.spriteNum)
  70.           puppetSound(3, "pickcard")
  71.         else
  72.           puppetSound(3, "dropcard")
  73.           sprite(me.spriteNum).moveableSprite = 0
  74.           sprite(me.spriteNum).locZ = the clickOn
  75.           sprite(me.spriteNum).loc = tableau[string(sprite(me.spriteNum).startFrame).symbol].cards[string(me.spriteNum).symbol].location
  76.         end if
  77.       end if
  78.     end if
  79.   else
  80.     getpile()
  81.   end if
  82.   repeat with i = 8 to 147
  83.     if sprite(i).visible = 1 then
  84.       sprite(i).locZ = i
  85.       next repeat
  86.     end if
  87.     sprite(i).locZ = -1000
  88.   end repeat
  89.   checklose()
  90. end
  91.  
  92. on getpile
  93.   global sha, tableau, equalvalue2, hotti
  94.   if sha.count > 0 then
  95.     if equalvalue2 = 0 then
  96.       puppetSound(3, "dropcard")
  97.       sprite(the clickOn).loc = tableau[symbol(string(sprite(the clickOn).startFrame))].cards[string(the clickOn).symbol].location
  98.       sprite(the clickOn).locZ = tableau[symbol(string(sprite(the clickOn).startFrame))].cards[string(the clickOn).symbol].spnum
  99.       sprite(the clickOn).moveableSprite = 0
  100.       repeat with i = 1 to sha.count
  101.         sprite(the clickOn + i).locZ = the clickOn + i
  102.         sprite(the clickOn + i).moveableSprite = 0
  103.         sprite(the clickOn + i).loc = tableau[string(sprite(the clickOn + i).startFrame).symbol].cards[string(the clickOn + i).symbol].location
  104.       end repeat
  105.       sha.deleteAll()
  106.     else
  107.       puppetSound(3, "pickcard")
  108.       sprite(the clickOn).loc = tableau[symbol(string(sprite(the clickOn).startFrame))].cards[string(the clickOn).symbol].location
  109.       sprite(the clickOn).locZ = tableau[symbol(string(sprite(the clickOn).startFrame))].cards[string(the clickOn).symbol].spnum
  110.       sprite(the clickOn).visible = 0
  111.       sprite(the clickOn).moveableSprite = 0
  112.       sprite(hotti).member = sprite(the clickOn).member
  113.       sprite(hotti).visible = 1
  114.       tableau[symbol(string(sprite(hotti).startFrame))].addcards(symbol(string(hotti)), new(script("card"), hotti))
  115.       tableau[symbol(string(sprite(the clickOn).startFrame))].substractcards(symbol(string(the clickOn)))
  116.       repeat with i = 1 to sha.count
  117.         sprite(the clickOn + i).moveableSprite = 0
  118.         sprite(the clickOn + i).locZ = the clickOn + i
  119.         sprite(the clickOn + i).loc = tableau[string(sprite(the clickOn + i).startFrame).symbol].cards[string(the clickOn + i).symbol].location
  120.         sprite(the clickOn + i).visible = 0
  121.         sprite(hotti + i).member = sprite(the clickOn + i).member
  122.         sprite(hotti + i).visible = 1
  123.         tableau[symbol(string(sprite(hotti + i).startFrame))].addcards(symbol(string(hotti + i)), new(script("card"), hotti + i))
  124.         tableau[symbol(string(sprite(the clickOn + i).startFrame))].substractcards(symbol(string(the clickOn + i)))
  125.       end repeat
  126.       repeat with i = 150 to 156
  127.         if tableau[string(sprite(i).startFrame).symbol].cards.count = 0 then
  128.           next repeat
  129.         end if
  130.         sprite(i).loc = tableau[string(sprite(i).startFrame).symbol].cards[tableau[string(sprite(i).startFrame).symbol].cards.count].location
  131.       end repeat
  132.     end if
  133.   end if
  134. end
  135.  
  136. on checkfound spritenu
  137.   global equal_value, points, hots, tableau, foundation
  138.   if the clickOn = spritenu then
  139.     if (equal_value = 1) and (hots <> 0) then
  140.       sprite(hots).member = tableau[string(sprite(spritenu).startFrame).symbol].cards[string(spritenu).symbol].membername
  141.       sprite(spritenu).visible = 0
  142.       sprite(spritenu).locZ = -1000
  143.       sprite(spritenu).loc = tableau[string(sprite(spritenu).startFrame).symbol].cards[string(spritenu).symbol].location
  144.       foundation[symbol(string(hots))].cards.add(tableau[string(sprite(spritenu).startFrame).symbol].cards[string(spritenu).symbol])
  145.       tableau[string(sprite(spritenu).startFrame).symbol].substractcards(string(spritenu).symbol)
  146.       points = points + 15
  147.       if sprite(hots).blendLevel = 0 then
  148.         sprite(hots).blendLevel = 255
  149.       end if
  150.     end if
  151.   end if
  152. end
  153.  
  154. on checktab spritenu
  155.   global equalvalue2, points, hotti, tableau, foundation, sha
  156.   if the clickOn = spritenu then
  157.     if (equalvalue2 = 1) and (hotti <> 0) then
  158.       sprite(hotti).member = tableau[string(sprite(spritenu).startFrame).symbol].cards[string(spritenu).symbol].membername
  159.       sprite(spritenu).visible = 0
  160.       sprite(spritenu).locZ = spritenu
  161.       sprite(spritenu).loc = tableau[string(sprite(spritenu).startFrame).symbol].cards[string(spritenu).symbol].location
  162.       tableau[string(sprite(hotti).startFrame).symbol].addcards(string(hotti).symbol, new(script("card"), hotti))
  163.       tableau[string(sprite(spritenu).startFrame).symbol].substractcards(string(spritenu).symbol)
  164.       sprite(hotti).visible = 1
  165.       repeat with i = 150 to 156
  166.         if tableau[string(sprite(i).startFrame).symbol].cards.count = 0 then
  167.           next repeat
  168.         end if
  169.         sprite(i).loc = tableau[string(sprite(i).startFrame).symbol].cards[tableau[string(sprite(i).startFrame).symbol].cards.count].location
  170.       end repeat
  171.     end if
  172.   end if
  173. end
  174.  
  175. on checkpilepos posi
  176.   global tableau
  177.   proxymoxy = []
  178.   t = tableau[string(sprite(posi).startFrame).symbol].cards.findPos(string(posi).symbol)
  179.   j = tableau[string(sprite(posi).startFrame).symbol]
  180.   if t <> tableau[string(sprite(posi).startFrame).symbol].cards.count then
  181.     i = 0
  182.     repeat while i < (tableau[string(sprite(posi).startFrame).symbol].cards.count - t)
  183.       i = i + 1
  184.       if tableau[string(sprite(posi).startFrame).symbol].cards[t + i].suitcolor <> tableau[string(sprite(posi).startFrame).symbol].cards[t].suitcolor then
  185.         exit repeat
  186.       end if
  187.       if tableau[string(sprite(posi).startFrame).symbol].cards[t + i].rankvalue <> (tableau[string(sprite(posi).startFrame).symbol].cards[t].rankvalue - i) then
  188.         exit repeat
  189.       end if
  190.       proxymoxy.add(tableau[string(sprite(posi).startFrame).symbol].cards[t + i])
  191.       if i <> (tableau[string(sprite(posi).startFrame).symbol].cards.count - t) then
  192.         next repeat
  193.       end if
  194.       sprite(posi).locZ = 1000
  195.       setemuphigh(proxymoxy, posi)
  196.     end repeat
  197.   else
  198.     sprite(the clickOn).locZ = 1000
  199.     sprite(the clickOn).moveableSprite = 1
  200.   end if
  201. end
  202.  
  203. on setemuphigh yoyo, bvc
  204.   global sha
  205.   sha = yoyo
  206.   sprite(bvc).moveableSprite = 1
  207.   repeat with s = 1 to yoyo.count
  208.     add(the actorList, yoyo[s])
  209.     sprite(yoyo[s].spnum).locZ = 1000
  210.   end repeat
  211. end
  212.  
  213. on backCardEQ me
  214.   global tableau
  215.   if spriteNum <> tableau[string(sprite(me.spriteNum).startFrame).symbol].cards[1].spnum then
  216.     if (sprite(spriteNum - 1).member.name <> "backofcard") and (sprite(spriteNum - 1).member.name <> "empty") then
  217.       if (getValue(sprite(spriteNum).member.name) = (getValue(sprite(spriteNum - 1).member.name) - 1)) and (getSuitCo(sprite(spriteNum).member.name) <> getSuitCo(sprite(spriteNum - 1).member.name)) then
  218.         repeat with shit = spriteNum - 1 to spriteNum - 1
  219.           repeat with cakes = 1 to tableau.count
  220.             if tableau[cakes].cards.count = 0 then
  221.               next repeat
  222.             end if
  223.             if (getValue(sprite(shit).member.name) = (getValue(sprite(tableau[cakes].cards[tableau[cakes].cards.count].spnum).member.name) - 1)) and (getSuitCo(sprite(shit).member.name) = getSuitCo(sprite(tableau[cakes].cards[tableau[cakes].cards.count].spnum).member.name)) and not getduplicateme(tableau[cakes].cards[tableau[cakes].cards.count].spnum) then
  224.               return 1
  225.               exit
  226.               next repeat
  227.             end if
  228.             if (getValue(sprite(shit).member.name) = 13) and (getValue(sprite(tableau[cakes].cards[tableau[cakes].cards.count].spnum).member.name) = 1) and (getSuitCo(sprite(shit).member.name) = getSuitCo(sprite(tableau[cakes].cards[tableau[cakes].cards.count].spnum).member.name)) and not getduplicateme(tableau[cakes].cards[tableau[cakes].cards.count].spnum) then
  229.               return 1
  230.               exit
  231.             end if
  232.           end repeat
  233.         end repeat
  234.       else
  235.         sendSprite(spriteNum - 1, #backCardEQ)
  236.       end if
  237.     end if
  238.   end if
  239.   return 0
  240. end
  241.  
  242. on getduplicateme me, argu
  243.   if (sprite(spriteNum - 1).member.name <> "empty") and (sprite(spriteNum - 1).member.name <> "backofcard") then
  244.     if (getValue(sprite(spriteNum - 1).member.name) = getValue(sprite(argu).member.name)) and (getSuitCo(sprite(spriteNum - 1).member.name) = getSuitCo(sprite(argu).member.name)) then
  245.       return 1
  246.     end if
  247.   end if
  248.   return 0
  249. end
  250.