home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 6 / MacAddict_006_1997_02.iso / media / RESOURCES.Dxr / 00025.ls < prev    next >
Encoding:
Text File  |  1996-11-22  |  11.2 KB  |  348 lines

  1. on startMovie
  2.   global arrows, dbase
  3.   clearGlobals()
  4.   setControls(0)
  5.   set dbase to new(script "databaseClass", "ShareData")
  6.   set arrows to getspritelist("a_")
  7.   repeat with spritenum in arrows
  8.     set the visible of sprite spritenum to 0
  9.   end repeat
  10.   updateStage()
  11. end
  12.  
  13. on stopMovie
  14.   setvolume(128)
  15. end
  16.  
  17. on scrollthumb minscroll, maxscroll, scrollfield
  18.   set spritenum to the clickOn
  19.   set thumb to the memberNum of sprite spritenum
  20.   set thumbdown to the number of member (the name of member thumb & "Down")
  21.   puppetSprite(spritenum, 1)
  22.   set the memberNum of sprite spritenum to thumbdown
  23.   updateStage()
  24.   set curv to the mouseV
  25.   set delta to curv - the locV of sprite spritenum
  26.   set curlineheight to the textHeight of member scrollfield
  27.   set lineCount to the lineCount of member scrollfield
  28.   set totalheight to curlineheight * lineCount
  29.   set pageHeight to the pageHeight of member scrollfield
  30.   set remainder to totalheight - pageHeight + 1
  31.   repeat while the mouseDown
  32.     if totalheight <= pageHeight then
  33.       exit repeat
  34.     end if
  35.     set curv to min(max(the mouseV - delta, minscroll), maxscroll)
  36.     set the locV of sprite spritenum to curv
  37.     updateStage()
  38.     set the scrollTop of member scrollfield to curlineheight * integer((curv - minscroll) * remainder / ((maxscroll - minscroll) * curlineheight))
  39.     if not soundBusy(2) then
  40.       puppetSound(2, 0)
  41.       puppetSound(2, "Teletype A")
  42.     end if
  43.   end repeat
  44.   puppetSound(2, 0)
  45.   set the memberNum of sprite spritenum to thumb
  46.   updateStage()
  47. end
  48.  
  49. on scroll direction, minscroll, maxscroll, scrollfield, thumbsymbol
  50.   set scrollfield to string(scrollfield)
  51.   set thumb to castspritea(string(thumbsymbol))
  52.   set curlineheight to the textHeight of member scrollfield
  53.   set lineCount to the lineCount of member scrollfield
  54.   set totalheight to curlineheight * lineCount
  55.   set pageHeight to the pageHeight of member scrollfield
  56.   set remainder to totalheight - pageHeight
  57.   if totalheight <= pageHeight then
  58.     exit
  59.   end if
  60.   repeat while the mouseDown
  61.     set oldpos to the scrollTop of member scrollfield
  62.     set pos to min(max(oldpos + (curlineheight * direction), 0), remainder)
  63.     set the scrollTop of member scrollfield to pos
  64.     set the locV of sprite thumb to minscroll + (pos * (maxscroll - minscroll) / remainder)
  65.     updateStage()
  66.     if not soundBusy(2) then
  67.       puppetSound(2, 0)
  68.       puppetSound(2, "Teletype A")
  69.     end if
  70.   end repeat
  71.   puppetSound(2, 0)
  72.   puppetSprite(thumb, 1)
  73. end
  74.  
  75. on showInstall
  76.   set spritenum to castspritea("Cable")
  77.   puppetSound(2, 0)
  78.   puppetSound(2, "blooip")
  79.   puppetSprite(spritenum, 1)
  80.   repeat with index = -8 to 8
  81.     set pos to index * 40
  82.     set the locH of sprite spritenum to pos
  83.     updateStage()
  84.   end repeat
  85. end
  86.  
  87. on hideInstall
  88.   set spritenum to castspritea("Cable")
  89.   if the locH of sprite spritenum <> 320 then
  90.     exit
  91.   end if
  92.   puppetSound(2, 0)
  93.   puppetSound(2, "pioolb")
  94.   puppetSprite(spritenum, 1)
  95.   repeat with index = 8 down to -8
  96.     set pos to index * 40
  97.     set the locH of sprite spritenum to pos
  98.     updateStage()
  99.   end repeat
  100. end
  101.  
  102. on convertThisIssue datasrc, datatarget
  103.   set text to the text of field datasrc
  104.   set datalength to 8
  105.   set delimiter to ";"
  106.   set text to replace(text, delimiter, ",")
  107.   set tempdata to []
  108.   set buffer to EMPTY
  109.   set starttemplate to [#section: EMPTY, #category: EMPTY, #name: EMPTY, #filepath: EMPTY, #description: EMPTY, #contact: EMPTY, #url: EMPTY]
  110.   set template to [#name: EMPTY, #section: "Shareware", #category: EMPTY, #filepath: EMPTY, #image: EMPTY, #video: EMPTY, #text: EMPTY, #url: EMPTY, #description: EMPTY, #contact: EMPTY]
  111.   set numrecords to integer(the number of lines in text / datalength)
  112.   repeat with recnum = 0 to numrecords - 1
  113.     set tempdata to EMPTY
  114.     repeat with j = 0 to datalength - 1
  115.       set curline to (recnum * datalength) + j + 1
  116.       set linetext to line curline of text
  117.       put linetext
  118.       if j < (datalength - 1) then
  119.         set tempdata to tempdata & linetext & delimiter
  120.       end if
  121.     end repeat
  122.     delete char -30000 of tempdata
  123.     set oldrec to filltemplate(starttemplate, tempdata, delimiter)
  124.     put oldrec
  125.     put the name of oldrec
  126.     set rec to duplicate(template)
  127.     repeat with index = 1 to count(starttemplate)
  128.       set prop to getPropAt(oldrec, index)
  129.       setProp(rec, prop, getProp(oldrec, prop))
  130.     end repeat
  131.     set buffer to buffer & listtotext(rec, delimiter) & RETURN
  132.   end repeat
  133.   delete char -30000 of buffer
  134.   set buffer to replace(buffer, delimiter, numToChar(9))
  135.   put buffer into field datatarget
  136. end
  137.  
  138. on convertShareware datasrc, datatarget
  139.   set text to the text of field datasrc
  140.   set datalength to 6
  141.   set delimiter to ";"
  142.   set text to replace(text, delimiter, ",")
  143.   set tempdata to []
  144.   set buffer to EMPTY
  145.   set starttemplate to [#name: EMPTY, #category: EMPTY, #url: EMPTY, #filepath: EMPTY, #description: EMPTY]
  146.   set template to [#name: EMPTY, #section: "Shareware", #category: EMPTY, #filepath: EMPTY, #image: EMPTY, #video: EMPTY, #text: EMPTY, #url: EMPTY, #description: EMPTY, #contact: EMPTY]
  147.   set numrecords to integer(the number of lines in text / datalength)
  148.   repeat with recnum = 0 to numrecords - 1
  149.     set tempdata to EMPTY
  150.     repeat with j = 0 to datalength - 1
  151.       set curline to (recnum * datalength) + j + 1
  152.       set linetext to line curline of text
  153.       put linetext
  154.       if j < (datalength - 1) then
  155.         set tempdata to tempdata & linetext & delimiter
  156.       end if
  157.     end repeat
  158.     delete char -30000 of tempdata
  159.     set oldrec to filltemplate(starttemplate, tempdata, delimiter)
  160.     put oldrec
  161.     put the name of oldrec
  162.     set rec to duplicate(template)
  163.     repeat with index = 1 to count(starttemplate)
  164.       set prop to getPropAt(oldrec, index)
  165.       setProp(rec, prop, getProp(oldrec, prop))
  166.     end repeat
  167.     set buffer to buffer & listtotext(rec, delimiter) & RETURN
  168.   end repeat
  169.   delete char -30000 of buffer
  170.   set buffer to replace(buffer, delimiter, numToChar(9))
  171.   put buffer into field datatarget
  172. end
  173.  
  174. on showLaunchDlg
  175.   global dbase, modality
  176.   puppetSound(2, 0)
  177.   puppetSound(2, "blooip")
  178.   set dlgsprite to castspritea("null")
  179.   puppetSprite(dlgsprite, 1)
  180.   set the memberNum of sprite dlgsprite to the number of member "Warning"
  181.   if the url of the activerec of dbase <> "n/a" then
  182.     set urlbtn to castspritea("null")
  183.     puppetSprite(urlbtn, 1)
  184.     set the memberNum of sprite urlbtn to the number of member "launchURL"
  185.   end if
  186.   set launchbtn to castspritea("null")
  187.   puppetSprite(launchbtn, 1)
  188.   set the memberNum of sprite launchbtn to the number of member "InstallAppBtn"
  189.   set infotext to castspritea("null")
  190.   puppetSprite(infotext, 1)
  191.   set the memberNum of sprite infotext to the number of member "ContactInfo"
  192.   set rec to the activerec of dbase
  193.   set the text of field "ContactInfo" to outsafeput(the contact of rec)
  194.   set the loc of sprite infotext to point(161, 247)
  195.   updateStage()
  196.   set modality to 1
  197. end
  198.  
  199. on HideLaunchDlg
  200.   global dbase, modality
  201.   set dlgsprite to castspritea("Warning")
  202.   puppetSprite(dlgsprite, 1)
  203.   set the memberNum of sprite dlgsprite to the number of member "null"
  204.   if the url of the activerec of dbase <> "n/a" then
  205.     set urlbtn to castspritea("launchURL")
  206.     puppetSprite(urlbtn, 1)
  207.     set the memberNum of sprite urlbtn to the number of member "null"
  208.   end if
  209.   set launchbtn to castspritea("InstallAppBtn")
  210.   puppetSprite(launchbtn, 1)
  211.   set the memberNum of sprite launchbtn to the number of member "null"
  212.   set infotext to castspritea("ContactInfo")
  213.   puppetSprite(infotext, 1)
  214.   set the memberNum of sprite infotext to the number of member "null"
  215.   set the text of field "ContactInfo" to " "
  216.   updateStage()
  217.   puppetSprite(dlgsprite, 0)
  218.   puppetSprite(urlbtn, 0)
  219.   puppetSprite(launchbtn, 0)
  220.   puppetSprite(infotext, 0)
  221.   set modality to 0
  222. end
  223.  
  224. on launchURL
  225.   puppetSound(2, 0)
  226.   puppetSound(2, "launchURLSound")
  227. end
  228.  
  229. on launchApp myfilepath
  230.   global dbase
  231.   puppetSound(2, 0)
  232.   puppetSound(2, "launchAppSound")
  233.   if castspritea("password") then
  234.     HidePasswordDlg()
  235.     if the text of member "passwordtext" = "frag1le" then
  236.       loadfile(dbase)
  237.     end if
  238.   else
  239.     open(myfilepath)
  240.   end if
  241. end
  242.  
  243. on ShowPasswordDlg
  244.   global dbase, modality
  245.   puppetSound(2, 0)
  246.   puppetSound(2, "blooip")
  247.   set dlgsprite to castspritea("null")
  248.   puppetSprite(dlgsprite, 1)
  249.   set the memberNum of sprite dlgsprite to the number of member "Password"
  250.   set urlbtn to castspritea("null")
  251.   puppetSprite(urlbtn, 1)
  252.   set the memberNum of sprite urlbtn to the number of member "launchURL"
  253.   set launchbtn to castspritea("null")
  254.   puppetSprite(launchbtn, 1)
  255.   set the memberNum of sprite launchbtn to the number of member "InstallAppBtn"
  256.   set infotext to castspritea("null")
  257.   puppetSprite(infotext, 1)
  258.   set the memberNum of sprite infotext to the number of member "passwordtext"
  259.   set rec to the activerec of dbase
  260.   set the text of field "passwordtext" to outsafeput(the contact of rec)
  261.   set the loc of sprite infotext to point(161, 247)
  262.   updateStage()
  263.   set modality to 1
  264. end
  265.  
  266. on HidePasswordDlg
  267.   global modality
  268.   set dlgsprite to castspritea("Password")
  269.   puppetSprite(dlgsprite, 1)
  270.   set the memberNum of sprite dlgsprite to the number of member "null"
  271.   set urlbtn to castspritea("launchURL")
  272.   puppetSprite(urlbtn, 1)
  273.   set the memberNum of sprite urlbtn to the number of member "null"
  274.   set launchbtn to castspritea("InstallAppBtn")
  275.   puppetSprite(launchbtn, 1)
  276.   set the memberNum of sprite launchbtn to the number of member "null"
  277.   set infotext to castspritea("passwordtext")
  278.   puppetSprite(infotext, 1)
  279.   set the memberNum of sprite infotext to the number of member "null"
  280.   set the text of field "ContactInfo" to " "
  281.   updateStage()
  282.   puppetSprite(dlgsprite, 0)
  283.   puppetSprite(urlbtn, 0)
  284.   puppetSprite(launchbtn, 0)
  285.   puppetSprite(infotext, 0)
  286.   set modality to 0
  287. end
  288.  
  289. on setControls state
  290.   puppetSound(2, 0)
  291.   if state then
  292.     puppetSound(2, "blooip")
  293.   else
  294.     puppetSound(2, "pioolb")
  295.   end if
  296.   set btnlist to ["controls", "backbtn", "menubtn", "infobtn", "quitbtn", "audiothumb"]
  297.   repeat with ctrl in btnlist
  298.     set the visible of sprite castsprite(ctrl) to state
  299.   end repeat
  300. end
  301.  
  302. on setLoadingDlgBox state
  303.   set the visible of sprite castsprite("loaddlgbox") to state
  304.   set the visible of sprite castsprite("loaddlg1") to state
  305.   if state = 1 then
  306.     set loadanimsprite to castsprite("loaddlg1")
  307.     puppetSprite(loadanimsprite, 1)
  308.     repeat with index = 1 to 4
  309.       set the memberNum of sprite loadanimsprite to the number of member ("loaddlg" & string(index))
  310.       updateStage()
  311.       startTimer()
  312.       repeat while the timer < 15
  313.       end repeat
  314.     end repeat
  315.   end if
  316. end
  317.  
  318. on jumpMovie movieName
  319.   go(1, movieName)
  320. end
  321.  
  322. on setSoundLevel whichsprite, pmin, pmax
  323.   global gSoundLevel, gThumbPuppet
  324.   set curpos to the locH of sprite whichsprite
  325.   set gSoundLevel to integer((curpos - pmin) * 8 / (pmax - pmin))
  326.   set gSoundLevel to min(max(gSoundLevel, 0), 7)
  327.   setvolume(gSoundLevel * 255 / 7)
  328.   set the soundLevel to gSoundLevel
  329.   set gThumbPuppet to whichsprite
  330.   return gSoundLevel
  331. end
  332.  
  333. on setSoundPos whichsprite, pmin, pmax
  334.   global gSoundLevel, gThumbPuppet
  335.   set curpos to pmin + integer(gSoundLevel * (pmax - pmin) / 7)
  336.   puppetSprite(whichsprite, 1)
  337.   set the locH of sprite whichsprite to curpos
  338.   updateStage()
  339.   set gThumbPuppet to whichsprite
  340.   return curpos
  341. end
  342.  
  343. on clearThumb
  344.   global gThumbPuppet
  345.   puppetSprite(gThumbPuppet, 0)
  346.   updateStage()
  347. end
  348.