home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00401_CONSTRUCTORS.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  5.9 KB  |  197 lines

  1. global vNewSUBlist
  2.  
  3. on hBuildAttrib startcast, stopcast, namelist
  4.   global Lattriblist
  5.   set the itemDelimiter to "~"
  6.   set Lattriblist to value(field ("ATTRIB_" & namelist))
  7.   if not objectp(Lattriblist) then
  8.     hReportStatus("Index not creatable from whatever is in field ATTRIB_" & namelist)
  9.     hearit(gNopeSND)
  10.     return 
  11.   end if
  12.   repeat with n = startcast to stopcast
  13.     put "Cast" && n
  14.     set imax to the number of items in field n
  15.     repeat with i = 1 to imax
  16.       set Ltempchunk to item i of field n
  17.       set the itemDelimiter to "@"
  18.       set Ltempentryname to item 2 of Ltempchunk
  19.       delete char 1 of Ltempentryname
  20.       set Lpos to findPos(Lattriblist, Ltempentryname)
  21.       if voidp(Lpos) then
  22.         set Lpos to findPos(Lattriblist, hTryAltQuotes(Ltempentryname))
  23.         if voidp(Lpos) then
  24.           hputmsg("Couldnt find >" & Ltempentryname & "< in field ATTRIB_" & namelist)
  25.           hputmsg("at item" && i && "in cast" && n)
  26.           stall()
  27.         end if
  28.       end if
  29.       set LtheseAttribs to getAt(Lattriblist, Lpos)
  30.       setAt(LtheseAttribs, 1, 0)
  31.       setAt(LtheseAttribs, 2, 0)
  32.       setAt(LtheseAttribs, 3, 0)
  33.       setAt(LtheseAttribs, 4, -1)
  34.       setAt(LtheseAttribs, 5, 0)
  35.       setAt(LtheseAttribs, 6, 0)
  36.       setAt(LtheseAttribs, 7, 0)
  37.       setAt(LtheseAttribs, 8, 1)
  38.       setAt(LtheseAttribs, 9, n)
  39.       setAt(LtheseAttribs, 10, i)
  40.       setAt(Lattriblist, Lpos, LtheseAttribs)
  41.       set the itemDelimiter to "~"
  42.     end repeat
  43.   end repeat
  44.   put Lattriblist into field ("NEW_" & namelist)
  45. end
  46.  
  47. on hTryAltQuotes thisname
  48.   if char 1 of thisname = QUOTE then
  49.     put "'" into char 1 of thisname
  50.     put "'" into char length(thisname) of thisname
  51.   end if
  52.   return thisname
  53. end
  54.  
  55. on hsizereport P1, p2
  56.   repeat with i = P1 to p2
  57.     if (the castType of cast i = #text) or (the castType of cast i = #script) then
  58.       preLoadCast(i)
  59.       put i && the name of cast i && "=" && the size of cast i / 1024 & "K bytes"
  60.       if (the size of cast i / 1024) > 32 then
  61.         put "FIX " && the name of cast i && "it has " & the size of cast i / 1024 & "K bytes"
  62.       end if
  63.     end if
  64.   end repeat
  65. end
  66.  
  67. on hUpdateCastTable
  68.   put "CAST UPDATE BEGINS"
  69.   set Lstart to 501
  70.   set Lend to 999
  71.   put "Scanning from cast" && Lstart && "to" && Lend
  72.   set Ltemplist to [:]
  73.   repeat with i = Lstart to Lend
  74.     addProp(Ltemplist, i, the name of cast i)
  75.   end repeat
  76.   put Ltemplist into field "CastTable500"
  77.   set Lstart to 1000
  78.   set Lend to 1999
  79.   put "Scanning from cast" && Lstart && "to" && Lend && "(start of the picons)."
  80.   set Ltemplist to [:]
  81.   repeat with i = Lstart to Lend
  82.     addProp(Ltemplist, i, the name of cast i)
  83.   end repeat
  84.   put Ltemplist into field "CastTable1000"
  85.   set Lstart to 2000
  86.   set Lend to 2999
  87.   put "Scanning from cast" && Lstart && "to" && Lend
  88.   set Ltemplist to [:]
  89.   repeat with i = Lstart to Lend
  90.     addProp(Ltemplist, i, the name of cast i)
  91.   end repeat
  92.   put Ltemplist into field "CastTable2000"
  93.   put "Adjusting internal data table... Doing step 1 of 3." into field "Status"
  94.   put "Casts 'Casttable...' have been updated."
  95.   put "'hAssembleScrollLists' now updating ATTRIB lists."
  96.   hAssembleScrollLists()
  97. end
  98.  
  99. on hAssembleScrollLists
  100.   global gLastYearK
  101.   if voidp(gLastYearK) then
  102.     hputmsg("hAssembleScrollLists needs a value for gLastYearK")
  103.   end if
  104.   set Lthelist to []
  105.   set Laccum to 0
  106.   repeat with i = 65 to 90
  107.     put "." after field "Status"
  108.     set Ltemp to value(field ("ATTRIB_" & numToChar(i) & "_ENCY"))
  109.     set Laccum to Laccum + count(Ltemp)
  110.     append(Lthelist, Laccum)
  111.   end repeat
  112.   put Lthelist into field "ENCY_ScrollPoints"
  113.   put "Adjusting internal data table... Doing step 2 of 3." into field "Status"
  114.   put "Phew!"
  115. end
  116.  
  117. on hMakeChroPoints
  118.   global gLastYearK
  119.   set Lthelist to []
  120.   set Laccum to 0
  121.   repeat with i = 1 to 17
  122.     setAt(Lthelist, i, Laccum)
  123.   end repeat
  124.   repeat with i = 18 to 24
  125.     put "." after field "Status"
  126.     set Ltemp to value(field ("ATTRIB_" & string(i) & "_CHRO"))
  127.     set Lsize to count(Ltemp)
  128.     set Laccum to Laccum + count(Ltemp)
  129.     append(Lthelist, Laccum)
  130.   end repeat
  131.   put Lthelist into field "CHRO_ScrollPoints"
  132. end
  133.  
  134. on hStripOldChron pStart, pend
  135.   repeat with Li = pStart to pend
  136.     set Loldname to the name of cast Li
  137.     set Lnewname to "NEW_" & Loldname
  138.     set Lnewlist to [:]
  139.     set Loldlist to value(field Li)
  140.     if not objectp(Loldlist) then
  141.       hReportStatus("Field" && Loldname && "didnt create a list.")
  142.       hearit(gNopeSND)
  143.       abort()
  144.     end if
  145.     set Lnumofmajoritems to count(Loldlist)
  146.     repeat with Lj = 1 to Lnumofmajoritems
  147.       set LanItem to getPropAt(Loldlist, Lj)
  148.       put "Working on:" && LanItem
  149.       set LitsValues to getAt(Loldlist, Lj)
  150.       set Lhowmanyvals to count(LitsValues)
  151.       repeat with lk = 1 to Lhowmanyvals
  152.         set Lprevname to getPropAt(LitsValues, lk)
  153.         if Lprevname <> LanItem then
  154.           set LmyNewName to LanItem && Lprevname
  155.         else
  156.           set LmyNewName to Lprevname
  157.         end if
  158.         put "A new name:" && LmyNewName
  159.         set LmyAttribs to getAt(LitsValues, lk)
  160.         addProp(Lnewlist, LmyNewName, LmyAttribs)
  161.       end repeat
  162.     end repeat
  163.     put Lnewlist into field Lnewname
  164.   end repeat
  165.   put "DONE."
  166. end
  167.  
  168. on hFindEntD pFirstFieldNum, pLastFieldNum
  169.   repeat with LthisFld = pFirstFieldNum to pLastFieldNum
  170.     set the itemDelimiter to "~"
  171.     set Lmax to the number of items in field LthisFld
  172.     put "Looking in field" && LthisFld
  173.     repeat with i = 1 to Lmax
  174.       if item i of field LthisFld contains "Enterprise -D" then
  175.         set Ltempfld to item i of field LthisFld
  176.         set the itemDelimiter to "@"
  177.         put item 2 of Ltempfld
  178.         set the itemDelimiter to "~"
  179.       end if
  180.     end repeat
  181.     put "Finished with field" && LthisFld
  182.   end repeat
  183.   put "ALL DONE."
  184. end
  185.  
  186. on builddirlist atpath
  187.   set thefileList to []
  188.   repeat with i = 1 to the maxinteger
  189.     set n to getNthFileNameInFolder(atpath, i)
  190.     if n = EMPTY then
  191.       exit repeat
  192.     end if
  193.     append(thefileList, n)
  194.   end repeat
  195.   return thefileList
  196. end
  197.