home *** CD-ROM | disk | FTP | other *** search
/ Knudde EK Editie / CD1.iso / schema.dxr / Script_2.ls < prev    next >
Encoding:
Text File  |  2000-02-24  |  8.1 KB  |  229 lines

  1. on LoadGroup Group
  2.   global PlayList, GroupList, ActivePlayList, ActiveGrouplist
  3.   ActivePlayList = getProp(PlayList, Group)
  4.   case Group of
  5.     #GroupA:
  6.       ActivePlayList = PlayList.GroupA
  7.       sprite(25).memberNum = 72
  8.     #GroupB:
  9.       ActivePlayList = PlayList.GroupB
  10.       sprite(25).memberNum = 73
  11.     #GroupC:
  12.       ActivePlayList = PlayList.GroupC
  13.       sprite(25).memberNum = 74
  14.     #GroupD:
  15.       ActivePlayList = PlayList.GroupD
  16.       sprite(25).memberNum = 75
  17.   end case
  18.   ActiveGrouplist = getProp(GroupList, Group)
  19.   PutGameData()
  20.   PutPouleData()
  21.   GroupAllInVis()
  22.   OneGroupVis()
  23. end
  24.  
  25. on PutGameData
  26.   global ActivePlayList
  27.   repeat with n = 1 to 6
  28.     Thuis = "Game" & n & "Home"
  29.     Uit = "Game" & n & "Out"
  30.     if getAt(getAt(getAt(ActivePlayList, n), 1), 1) = EMPTY then
  31.       sprite(54 + n).member = 81
  32.       put getAt(getAt(getAt(ActivePlayList, n), 1), 1) into field Thuis
  33.       put getAt(getAt(getAt(ActivePlayList, n), 1), 2) into field Uit
  34.       member(Thuis).editable = 1
  35.       member(Uit).editable = 1
  36.       next repeat
  37.     end if
  38.     sprite(54 + n).member = 82
  39.     put getAt(getAt(getAt(ActivePlayList, n), 1), 1) into field Thuis
  40.     put getAt(getAt(getAt(ActivePlayList, n), 1), 2) into field Uit
  41.     member(Thuis).editable = 0
  42.     member(Uit).editable = 0
  43.   end repeat
  44. end
  45.  
  46. on PutPouleData PorM
  47.   global ActivePlayList, ActiveGrouplist
  48.   TempPlaces = CheckPoints()
  49.   member("Place").text = EMPTY
  50.   put EMPTY into member "Played"
  51.   put EMPTY into member "Won"
  52.   put EMPTY into member "Draw"
  53.   put EMPTY into member "Lost"
  54.   put EMPTY into member "points"
  55.   put EMPTY into member "scored"
  56.   put EMPTY into member "against"
  57.   repeat with n = 1 to 4
  58.     put member("Place").text & getPropAt(ActiveGrouplist, getAt(TempPlaces, n)) & RETURN into member "Place"
  59.     put member("Played").text & getProp(getAt(ActiveGrouplist, getAt(TempPlaces, n)), #P) & RETURN into member "Played"
  60.     put member("Won").text & getProp(getAt(ActiveGrouplist, getAt(TempPlaces, n)), #W) & RETURN into member "Won"
  61.     put member("Draw").text & getProp(getAt(ActiveGrouplist, getAt(TempPlaces, n)), #d) & RETURN into member "Draw"
  62.     put member("Lost").text & getProp(getAt(ActiveGrouplist, getAt(TempPlaces, n)), #L) & RETURN into member "Lost"
  63.     put member("points").text & getProp(getAt(ActiveGrouplist, getAt(TempPlaces, n)), #PO) & RETURN into member "points"
  64.     put member("scored").text & getProp(getAt(ActiveGrouplist, getAt(TempPlaces, n)), #GF) & RETURN into member "scored"
  65.     put member("against").text & getProp(getAt(ActiveGrouplist, getAt(TempPlaces, n)), #GT) & RETURN into member "against"
  66.   end repeat
  67.   if PorM = #add then
  68.     CheckALlPlayed(TempPlaces)
  69.   else
  70.     if PorM = #Del then
  71.       CheckALLDelete()
  72.     end if
  73.   end if
  74. end
  75.  
  76. on CheckPoints
  77.   global ActiveGrouplist, TempPlace
  78.   temp = [1: 0, 2: 0, 3: 0, 4: 0]
  79.   TempPlace = 4
  80.   ZeroGames = []
  81.   BackUp = [:]
  82.   repeat with d = 1 to 4
  83.     repeat with n = 1 to 4
  84.       if d <> n then
  85.         if getProp(getAt(ActiveGrouplist, d), #PO) > getProp(getAt(ActiveGrouplist, n), #PO) then
  86.           TempPlace = TempPlace - 1
  87.           next repeat
  88.         end if
  89.         if getProp(getAt(ActiveGrouplist, d), #PO) = getProp(getAt(ActiveGrouplist, n), #PO) then
  90.           CheckGames(d, n, TempPlace)
  91.         end if
  92.       end if
  93.     end repeat
  94.     addProp(BackUp, TempPlace, d)
  95.     if getProp(getAt(ActiveGrouplist, d), #P) = 0 then
  96.       add(ZeroGames, d)
  97.     else
  98.       setProp(temp, TempPlace, d)
  99.     end if
  100.     TempPlace = 4
  101.   end repeat
  102.   if ZeroGames <> [] then
  103.     repeat with z = 1 to count(ZeroGames)
  104.       setProp(temp, getPos(temp, 0), getAt(ZeroGames, z))
  105.     end repeat
  106.   end if
  107.   repeat with n = 1 to 4
  108.     if getAt(temp, n) = 0 then
  109.       temp = DoBackUp(BackUp, temp)
  110.     end if
  111.   end repeat
  112.   return temp
  113. end
  114.  
  115. on CheckGames d, n, TempPlace
  116.   global ActiveGrouplist, TempPlace
  117.   if getProp(getAt(ActiveGrouplist, d), #P) < getProp(getAt(ActiveGrouplist, n), #P) then
  118.     TempPlace = TempPlace - 1
  119.   else
  120.     if getProp(getAt(ActiveGrouplist, d), #P) = getProp(getAt(ActiveGrouplist, n), #P) then
  121.       CheckGoals(d, n, TempPlace)
  122.     end if
  123.   end if
  124. end
  125.  
  126. on CheckGoals d, n, TempPlace
  127.   global ActiveGrouplist, TempPlace
  128.   if (getProp(getAt(ActiveGrouplist, d), #GF) - getProp(getAt(ActiveGrouplist, d), #GT)) > (getProp(getAt(ActiveGrouplist, n), #GF) - getProp(getAt(ActiveGrouplist, n), #GT)) then
  129.     TempPlace = TempPlace - 1
  130.   else
  131.     if (getProp(getAt(ActiveGrouplist, d), #GF) - getProp(getAt(ActiveGrouplist, d), #GT)) = (getProp(getAt(ActiveGrouplist, n), #GF) - getProp(getAt(ActiveGrouplist, n), #GT)) then
  132.       CheckGoalsVoor(d, n, TempPlace)
  133.     end if
  134.   end if
  135. end
  136.  
  137. on CheckGoalsVoor d, n, TempPlace
  138.   global ActiveGrouplist, TempPlace
  139.   if getProp(getAt(ActiveGrouplist, d), #GF) > getProp(getAt(ActiveGrouplist, n), #GF) then
  140.     TempPlace = TempPlace - 1
  141.   else
  142.     if getProp(getAt(ActiveGrouplist, d), #GF) = getProp(getAt(ActiveGrouplist, n), #GF) then
  143.       CheckGAmeAgainst(d, n, TempPlace)
  144.     end if
  145.   end if
  146. end
  147.  
  148. on CheckGAmeAgainst d, n, TempPlace
  149.   global ActiveGrouplist, ActivePlayList, TempPlace
  150.   repeat with g = 1 to 6
  151.     if (getPropAt(getAt(ActivePlayList, g).who, 2) = getPropAt(ActiveGrouplist, d)) and (getPropAt(getAt(ActivePlayList, g).who, 1) = getPropAt(ActiveGrouplist, n)) then
  152.       if getAt(getAt(ActivePlayList, g).who, 2) > getAt(getAt(ActivePlayList, g).who, 1) then
  153.         TempPlace = TempPlace - 1
  154.       else
  155.         if getAt(getAt(ActivePlayList, g).who, 2) = getAt(getAt(ActivePlayList, g).who, 1) then
  156.           if ((getAt(getAt(ActivePlayList, g).who, 1) = 0) and (getAt(getAt(ActivePlayList, g).who, 2) = 0)) or ((getAt(getAt(ActivePlayList, g).who, 1) = EMPTY) and (getAt(getAt(ActivePlayList, g).who, 2) = EMPTY)) then
  157.             CheckOutPoints(d, n, TempPlace)
  158.           else
  159.             TempPlace = TempPlace - 1
  160.           end if
  161.         end if
  162.       end if
  163.       next repeat
  164.     end if
  165.     if (getPropAt(getAt(ActivePlayList, g).who, 1) = getPropAt(ActiveGrouplist, d)) and (getPropAt(getAt(ActivePlayList, g).who, 2) = getPropAt(ActiveGrouplist, n)) then
  166.       if getAt(getAt(ActivePlayList, g).who, 1) > getAt(getAt(ActivePlayList, g).who, 2) then
  167.         TempPlace = TempPlace - 1
  168.         next repeat
  169.       end if
  170.       if getAt(getAt(ActivePlayList, g).who, 1) = getAt(getAt(ActivePlayList, g).who, 2) then
  171.         if ((getAt(getAt(ActivePlayList, g).who, 1) = 0) and (getAt(getAt(ActivePlayList, g).who, 2) = 0)) or ((getAt(getAt(ActivePlayList, g).who, 1) = EMPTY) and (getAt(getAt(ActivePlayList, g).who, 2) = EMPTY)) then
  172.           CheckOutPoints(d, n, TempPlace)
  173.           next repeat
  174.         end if
  175.       end if
  176.     end if
  177.   end repeat
  178. end
  179.  
  180. on CheckOutPoints d, n, TempPlace
  181.   global ActiveGrouplist, ActivePlayList, TempPlace
  182.   PlayOne = 0
  183.   PlayTwo = 0
  184.   repeat with g = 1 to 6
  185.     if getPropAt(getAt(ActivePlayList, g).who, 1) = getPropAt(ActiveGrouplist, d) then
  186.       if getAt(getAt(ActivePlayList, g).who, 1) <> EMPTY then
  187.         PlayOne = PlayOne + getAt(getAt(ActivePlayList, g).who, 1)
  188.       end if
  189.     end if
  190.     if getPropAt(getAt(ActivePlayList, g).who, 2) = getPropAt(ActiveGrouplist, d) then
  191.       if getAt(getAt(ActivePlayList, g).who, 2) <> EMPTY then
  192.         PlayOne = PlayOne + (getAt(getAt(ActivePlayList, g).who, 2) * 2)
  193.       end if
  194.     end if
  195.     if getPropAt(getAt(ActivePlayList, g).who, 1) = getPropAt(ActiveGrouplist, n) then
  196.       if getAt(getAt(ActivePlayList, g).who, 1) <> EMPTY then
  197.         PlayTwo = PlayTwo + getAt(getAt(ActivePlayList, g).who, 1)
  198.       end if
  199.     end if
  200.     if getPropAt(getAt(ActivePlayList, g).who, 2) = getPropAt(ActiveGrouplist, n) then
  201.       if getAt(getAt(ActivePlayList, g).who, 2) <> EMPTY then
  202.         PlayTwo = PlayTwo + (getAt(getAt(ActivePlayList, g).who, 2) * 2)
  203.       end if
  204.     end if
  205.   end repeat
  206.   if PlayOne > PlayTwo then
  207.     TempPlace = TempPlace - 1
  208.   else
  209.     if PlayOne = PlayTwo then
  210.       CheckAlpha(d, n, TempPlace)
  211.     end if
  212.   end if
  213. end
  214.  
  215. on CheckAlpha d, n, TempPlace
  216.   global ActiveGrouplist, TempPlace
  217.   if getProp(getAt(ActiveGrouplist, d), #Alpha) < getProp(getAt(ActiveGrouplist, n), #Alpha) then
  218.     TempPlace = TempPlace - 1
  219.   end if
  220. end
  221.  
  222. on DoBackUp BackUp, temp
  223.   sort(BackUp)
  224.   repeat with n = 1 to 4
  225.     setProp(temp, n, getAt(BackUp, n))
  226.   end repeat
  227.   return temp
  228. end
  229.