home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 12 / boot-disc-1997-08.iso / Media / Demos.dxr / Internal_1.ls < prev    next >
Encoding:
Text File  |  1997-06-12  |  7.3 KB  |  241 lines

  1. on startMovie
  2.   global DBfact, count, TBfact, descSprite, listSprite, videosprite, imagesprite, videoButton, launchButton, webButton, gpointer
  3.   clearGlobals()
  4.   set gpointer to [the number of member "pointer", the number of member "pointer.mask"]
  5.   if the machineType = 256 then
  6.     openXLib(the pathName & "xtras\V12Dbe")
  7.     openXLib(the pathName & "xtras\V12Table")
  8.     openXLib(the pathName & "XTRAS\FileIO")
  9.   else
  10.     openXLib(the pathName & "xtras:V12Dbe")
  11.     openXLib(the pathName & "xtras:V12Table")
  12.     openXLib(the pathName & "XTRAS:FileIOXtraFat")
  13.   end if
  14.   set DBfact to xtra("V12Dbe")
  15.   set TBfact to xtra("V12Table")
  16.   set the visible of sprite 2 to 0
  17.   puppetSprite(5, 1)
  18.   set videosprite to 26
  19.   set imagesprite to 22
  20.   put EMPTY into field "zlist"
  21.   put EMPTY into field "zspecial"
  22.   put "All Demos" into field "fld"
  23.   loadBrowser()
  24.   if the optionDown = 1 then
  25.     go("choice")
  26.   else
  27.     nothing()
  28.   end if
  29. end
  30.  
  31. on idle
  32.   set the visible of sprite 14 to rollOver(14)
  33.   set the visible of sprite 15 to rollOver(15)
  34.   set the visible of sprite 16 to rollOver(16)
  35.   set the visible of sprite 17 to rollOver(17)
  36.   set the visible of sprite 21 to rollOver(21)
  37. end
  38.  
  39. on stopMovie
  40.   global gTB, gDb
  41.   set gTB to 0
  42.   set gDb to 0
  43. end
  44.  
  45. on loadBrowser
  46.   global myFile
  47.   set gOSDir to getOSDirectory()
  48.   put gOSDir & "\" into field "OSPath"
  49.   put gOSDir & "\BROWSER.TXT" into field "ThePath"
  50.   set DaPath to field "ThePath"
  51.   if objectp(myFile) then
  52.     set myFile to 0
  53.   end if
  54.   set myFile to new(xtra("fileio"))
  55.   openFile(myFile, DaPath, 1)
  56.   set TheWeb to readLine(myFile)
  57.   put TheWeb into field "browserSelect"
  58.   closeFile(myFile)
  59.   set myFile to 0
  60. end
  61.  
  62. on scrollthumb minscroll, maxscroll, scrollfield
  63.   set spritenum to the clickOn
  64.   set thumb to the memberNum of sprite spritenum
  65.   set thumbdown to the number of member (the name of member thumb & "Down")
  66.   puppetSprite(spritenum, 1)
  67.   set the memberNum of sprite spritenum to thumbdown
  68.   updateStage()
  69.   set curv to the mouseV
  70.   set delta to curv - the locV of sprite spritenum
  71.   set curlineheight to the textHeight of member scrollfield
  72.   set lineCount to the lineCount of member scrollfield
  73.   set totalheight to curlineheight * lineCount
  74.   set pageHeight to the pageHeight of member scrollfield
  75.   set remainder to totalheight - pageHeight + 1
  76.   repeat while the mouseDown
  77.     if totalheight <= pageHeight then
  78.       exit repeat
  79.     end if
  80.     set curv to min(max(the mouseV - delta, minscroll), maxscroll)
  81.     set the locV of sprite spritenum to curv
  82.     updateStage()
  83.     set the scrollTop of member scrollfield to curlineheight * integer((curv - minscroll) * remainder / ((maxscroll - minscroll) * curlineheight))
  84.     if not soundBusy(2) then
  85.       puppetSound(2, 0)
  86.       puppetSound(2, "Teletype A")
  87.     end if
  88.   end repeat
  89.   puppetSound(2, 0)
  90.   set the memberNum of sprite spritenum to thumb
  91.   updateStage()
  92. end
  93.  
  94. on scroll direction, minscroll, maxscroll, scrollfield, thumbsymbol
  95.   set scrollfield to string(scrollfield)
  96.   set thumb to castspritea(string(thumbsymbol))
  97.   set curlineheight to the textHeight of member scrollfield
  98.   set lineCount to the lineCount of member scrollfield
  99.   set totalheight to curlineheight * lineCount
  100.   set pageHeight to the pageHeight of member scrollfield
  101.   set remainder to totalheight - pageHeight
  102.   if totalheight <= pageHeight then
  103.     exit
  104.   end if
  105.   repeat while the mouseDown
  106.     set oldpos to the scrollTop of member scrollfield
  107.     set pos to min(max(oldpos + (curlineheight * direction), 0), remainder)
  108.     set the scrollTop of member scrollfield to pos
  109.     set the locV of sprite thumb to minscroll + (pos * (maxscroll - minscroll) / remainder)
  110.     updateStage()
  111.     if not soundBusy(2) then
  112.       puppetSound(2, 0)
  113.       puppetSound(2, "Teletype A")
  114.     end if
  115.   end repeat
  116.   puppetSound(2, 0)
  117.   puppetSprite(thumb, 1)
  118. end
  119.  
  120. on showInstall
  121.   set spritenum to castspritea("Install")
  122.   puppetSound(2, 0)
  123.   puppetSound(2, "blooip")
  124.   puppetSprite(spritenum, 1)
  125.   repeat with index = -8 to 8
  126.     set pos to index * 40
  127.     set the locH of sprite spritenum to pos
  128.     updateStage()
  129.   end repeat
  130. end
  131.  
  132. on hideInstall
  133.   set spritenum to castspritea("Install")
  134.   if the locH of sprite spritenum <> 320 then
  135.     exit
  136.   end if
  137.   puppetSound(2, 0)
  138.   puppetSound(2, "pioolb")
  139.   puppetSprite(spritenum, 1)
  140.   repeat with index = 8 down to -8
  141.     set pos to index * 40
  142.     set the locH of sprite spritenum to pos
  143.     updateStage()
  144.   end repeat
  145. end
  146.  
  147. on doPopMenu spritenum, h, v
  148.   set the visible of sprite spritenum to 1
  149.   set the locH of sprite spritenum to h
  150.   set the locV of sprite spritenum to v
  151.   updateStage()
  152.   set cNum to the castNum of sprite spritenum
  153.   set lastSelection to 0
  154.   set len to the number of lines in field cNum
  155.   repeat while the stillDown
  156.     set mc to the mouseLine
  157.     if (0 < mc) and (mc <= len) and rollOver(spritenum) then
  158.       if mc <> lastSelection then
  159.         set lastSelection to mc
  160.         hilite line mc of field cNum
  161.         updateStage()
  162.       end if
  163.       next repeat
  164.     end if
  165.     if mc <> lastSelection then
  166.       set lastSelection to -1
  167.       hilite line len + 1 of field cNum
  168.       updateStage()
  169.     end if
  170.   end repeat
  171.   set the visible of sprite spritenum to 0
  172.   set the visible of sprite 47 to 0
  173.   updateStage()
  174.   if line lastSelection of field cNum <> EMPTY then
  175.     return lastSelection
  176.   else
  177.     return -1
  178.   end if
  179. end
  180.  
  181. on TrackClick
  182.   set spritenum to the clickOn
  183.   set offCast to the castNum of sprite spritenum
  184.   set onCast to offCast + 1
  185.   set the castNum of sprite spritenum to onCast
  186.   updateStage()
  187.   repeat while the mouseDown
  188.     if rollOver(spritenum) then
  189.       set the castNum of sprite spritenum to onCast
  190.     else
  191.       set the castNum of sprite spritenum to offCast
  192.     end if
  193.     updateStage()
  194.   end repeat
  195.   set the castNum of sprite spritenum to offCast
  196.   updateStage()
  197.   return rollOver(spritenum)
  198. end
  199.  
  200. on buttonClick whichSprite
  201.   puppetSprite(whichSprite, 1)
  202.   set the locV of sprite whichSprite to the locV of sprite whichSprite + 1
  203.   set the locH of sprite whichSprite to the locH of sprite whichSprite + 1
  204.   updateStage()
  205. end
  206.  
  207. on importFiles whichCastLib
  208.   alert("Please choose the text file list of the files to import.  Please make sure that the files are located in the same directory as the list.  Also, make sure that they are saved with the correct palette.")
  209.   set x to FileIO(mnew, "?read", EMPTY)
  210.   if objectp(x) then
  211.     set the text of field "newFileName" to x(mFileName)
  212.     x(mdispose)
  213.   else
  214.     set the text of field "newFileName" to EMPTY
  215.   end if
  216.   set i to the last item in field "newFileName"
  217.   importFileInto(member "the list" of castLib "internal", the text of field "newFilename")
  218.   if the text of field "newFilename" > EMPTY then
  219.     set the itemDelimiter to "."
  220.     delete char -30002 of i
  221.     set the text of field "files2import" to the text of member i
  222.   else
  223.     exit
  224.   end if
  225.   set the name of member i of castLib "internal" to "the list"
  226.   set x to 1
  227.   set y to the number of lines in field "files2import"
  228.   put y
  229.   delete char -30002 of field "newFileName"
  230.   repeat while x <= y
  231.     set name to line x of field "files2import"
  232.     put "Importing " & "'" & name & "'" into field "progress"
  233.     set thePath to the text of field "newfilename" & "\" & name
  234.     updateStage()
  235.     importFileInto(member x of castLib whichCastLib, thePath)
  236.     set x to x + 1
  237.   end repeat
  238.   alert("Done importing the listed files.")
  239.   put " " into field "progress"
  240. end
  241.