home *** CD-ROM | disk | FTP | other *** search
/ PC Action 1997 January / PCA0197.ISO / demos / ambe / roxy / roxy.dxr / 00174.ls < prev    next >
Encoding:
Text File  |  1996-10-28  |  3.1 KB  |  81 lines

  1. on enterFrame
  2.   global colorcrsr, domainIsReady
  3.   if the machineType <> 256 then
  4.     closeResFile()
  5.     openResFile(the pathName & "ROXY cursors")
  6.   end if
  7. end
  8.  
  9. on exitFrame
  10.   global oStoryteller, oPuppeteer, builderwindow, domainIsReady, building, fastLocationData, gVoid, gLocData
  11.   if not objectp(oPuppeteer) then
  12.     alert("Hey! There's no Puppeteer object")
  13.   end if
  14.   put "exitFrame(1 of ROXY): domainIsReady = " & domainIsReady
  15.   enterNewDomain(oPuppeteer, [field "LocationStubList"], "multiFrames", "foreground.DATA", "inventory.DATA")
  16.   set loadTime to the timer
  17.   REPORT2(" enterNewDomain(oPuppeteer) done at " & loadTime & " ticks")
  18.   set myMem to the freeBytes
  19.   if fastLocationData then
  20.     REPORT2("loading data from external data-files...")
  21.     set gLocData to [:]
  22.     set dataLoader to new(xtra("FileIO"))
  23.     if not objectp(dataLoader) then
  24.       alert("Sorry, unable to create the data-loader..")
  25.       quit()
  26.     end if
  27.     repeat with i = 1 to count(the locationSublists of oPuppeteer)
  28.       set roomName to getAt(the locationSublists of oPuppeteer, i)
  29.       openFile(dataLoader, the pathName & "Roxy_" & i & ".DAT", 1)
  30.       if error(dataLoader, status(dataLoader)) = "OK" then
  31.         setPosition(dataLoader, 0)
  32.         set timeStamp to readLine(dataLoader)
  33.         if char 1 to 30 of timeStamp <> line 2 of field "LocationStublist.OLD" then
  34.           alert("I wouldn't use this data if I were you... the time/date stamp doesn't              match the current location stub-list in this domain...")
  35.           set dataLoader to 0
  36.           set gLocData to gVoid
  37.           exit repeat
  38.         else
  39.           set roomString to readFile(dataLoader)
  40.           addProp(gLocData, roomName, roomString)
  41.           closefile(dataLoader)
  42.         end if
  43.         next repeat
  44.       end if
  45.       alert("Hm, there's some problem opening this file ('ROXY_" & i & ".DAT')..")
  46.       put error(dataLoader, status(dataLoader))
  47.       set gLocData to gVoid
  48.       exit repeat
  49.     end repeat
  50.     set dataLoader to 0
  51.     set timeElapsed to the timer
  52.     REPORT2(">ΓÇó> Finished loading loc-data at " & timeElapsed & " ticks..")
  53.     if voidp(gLocData) then
  54.       put "gLocData is now <void>..."
  55.     end if
  56.     if listp(gLocData) then
  57.       repeat with subString in gLocData
  58.       end repeat
  59.     end if
  60.   else
  61.     put "loading it from domain movie's cast..."
  62.     preLoadCast(30, 820)
  63.   end if
  64.   set loadTime to the timer
  65.   REPORT2(" preloading all location-data took about " & loadTime & " ticks")
  66.   REPORT2(" it also consumed " & myMem - the freeBytes & " bytes of RAM (" & (myMem - the freeBytes) / 1024 & " K)")
  67.   put "ΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇó"
  68.   if not objectp(colorcrsr) then
  69.     put "ΓÇóΓÇóΓÇóΓÇó Loading cast-cursorsΓǪ ΓÇóΓÇóΓÇóΓÇó"
  70.     preLoadCast(2501, 2738)
  71.     put "ΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇó Cursors loaded ΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇó"
  72.   end if
  73.   if not objectp(oStoryteller) then
  74.     alert("Hey! There's no Storyteller object")
  75.   end if
  76.   enablePeekAlert()
  77.   setProp(the lsStateData of oStoryteller, #currentDomain, ["ROXY"])
  78.   set the basePalette of oPuppeteer to the number of member "ROXY base"
  79.   REPORT2("Domain is ready = TRUE, at " & the timer & " ticks")
  80. end
  81.