home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 5 / boot-disc-1997-01.iso / media / demos.dir / 00001_Script_1 next >
Text File  |  1996-11-05  |  11KB  |  295 lines

  1. on startmovie
  2.   global dbase,cards
  3.   set cards=new(script "FlipperClass","Adonline","WC4",10,20,"updateRec")
  4.   set dbase=new(script "databaseClass","bootdata")
  5.   set curname=the name of member (the curcast of cards)
  6.   set rec=getrecordfromprop(dbase,#image,curname)
  7.   updateRec curname,true
  8.   puppetsound 1,0
  9.   puppetsound 2,0
  10. end
  11.  
  12. on updateRec name,clickedflag
  13.   puppetsound 2,0
  14.   puppetsound 2,"dleep"
  15.   global dbase,cards
  16.   set rec=getrecordfromprop(dbase,#image,name)
  17.   set namesprite=castspritea("name")
  18.   set description=castspritea("description")
  19.   set curpos=the locH of sprite namesprite
  20.   set curdescpos=the locV of sprite description
  21.   set delta=50
  22.   set numsteps=15
  23.   if not clickedflag then
  24.     puppetsprite namesprite,true
  25.     puppetsprite description,true
  26.     repeat with index=1 to numsteps
  27.       set curpos=curpos+delta
  28.       set curdescpos=curdescpos+delta
  29.       set the locH of sprite namesprite to curpos
  30.       set the locV of sprite description to curdescpos
  31.       updateStage
  32.       --      rotateJupiter
  33.     end repeat
  34.   end if
  35.   set the text of member "name" to the name of rec
  36.   set the text of member "description" to the description of rec
  37.   put (the special of rec) into field "special"
  38.   --  set the fontstyle of line spline of field "description" to "bold"
  39.   if not clickedflag then
  40.     repeat with index=numsteps down to 1
  41.       set curpos=curpos-delta
  42.       set curdescpos=curdescpos-delta
  43.       set the locH of sprite namesprite to curpos
  44.       set the locV of sprite description to curdescpos
  45.       updateStage
  46.       --      rotateJupiter
  47.     end repeat
  48.   end if 
  49.   puppetsprite namesprite,false
  50.   puppetsprite description,false
  51.   set the visible of sprite castspritea("launchDemo") to (the filepath of rec<>"")
  52.   set the visible of sprite castspritea("launchWWW") to (the url of rec<>"n/a")
  53.   if the platform="Windows,32" then
  54.     set the visible of sprite castspritea("PlayVideo") to (the video of rec<>"n/a")
  55.   else
  56.     set the visible of sprite castspritea("PlayVideo") to false
  57.   end if
  58.   set the visible of sprite castspritea("launchDemolt") to (the filepath of rec<>"")
  59.   set the visible of sprite castspritea("launchWWWlt") to (the url of rec<>"n/a")
  60.   if the platform="Windows,32" then
  61.     set the visible of sprite castspritea("PlayVideolt") to (the video of rec<>"n/a")
  62.   else
  63.     set the visible of sprite castspritea("PlayVideolt") to false
  64.   end if
  65.   if castspritea("thumb") then
  66.     moveThumb 395,450,"thumb",0.0,#vertical
  67.   end if
  68. end
  69.  
  70. on rotateJupiter
  71.   global state,jupitersprite
  72.   if jupitersprite=0 then set jupitersprite=castspritea("Jupiter1")
  73.   set state=(state mod 16)+1
  74.   if not the puppet of sprite jupitersprite then
  75.     puppetsprite jupitersprite,true
  76.   end if
  77.   set the membernum of sprite jupitersprite to the number of member ("Jupiter"&string(state))
  78.   updateStage
  79. end
  80.  
  81.  
  82.  
  83. on scrollthumb startpos,endpos,callback,orient
  84.   -- ScrollThumb is called by the thumb, constraining movement between
  85.   -- the starting and ending position (startpos and endpos).  Orient
  86.   -- is a symbol, with values being either #vertical (the
  87.   -- default) or #horizontal.  Callback is the name of a function
  88.   -- which accepts a floating point argument between 0.0 and 1.0.
  89.   -- The callback routine handles the translation between the 
  90.   -- normalized parameter and whatever's being scrolled (a text box,
  91.   -- a picture, whatever).  See the handler definition "on scrolltext"
  92.   -- to see an example of a callback function. ScrollThumb will return
  93.   -- a value between 0.0 and 1.0 when the mouse is released, indicating
  94.   -- how far between the start position and end position the thumb is
  95.   -- located.
  96.   --
  97.   -- When scrollthumb is called, it starts by checking to see if there
  98.   -- is a down state to the thumb graphic (the name of the down state
  99.   -- being the name of the up state with "Down" appended at the end,
  100.   -- i.e., upstate is "soundThumb", downstate is "soundThumbDown"). 
  101.   -- If there is, the downstate is used while the sprite is depressed; 
  102.   -- otherwise, the initial state (the up state) is used.
  103.   -- The callback routine is called continuously while the
  104.   -- mouse is down over the thumb; if the action is desired only upon
  105.   -- release of the thumb then the result of the scrollThumb function
  106.   -- should be caught by a variable.  The following example will
  107.   -- play the system beep sound while the mouse is down, then will
  108.   -- set a variable when the mouse is released: 
  109.   -- set percentage=scrollthumb(100,200,"beep",#vertical)
  110.   
  111.   set spritenum=the clickon
  112.   puppetsprite spritenum,true
  113.   set upcast=the membernum of sprite spritenum
  114.   set upcastname=the name of member upcast
  115.   set downcast=the number of member (upcastname&"Down")
  116.   if downcast<1 then set downcast=upcast
  117.   set the membernum of sprite spritenum to downcast
  118.   updateStage
  119.   if voidP(orient) then set orient=#vertical
  120.   if voidP(callback) then set callback=""
  121.   repeat while the mousedown
  122.     case orient of
  123.       #horizontal:
  124.         set pos=min(max(the mouseH,startpos),endpos)
  125.         set the locH of sprite spritenum to pos
  126.         updateStage
  127.         set ratio=(pos-startpos)*1.0/(endpos-startpos)
  128.         if callback<>"" then do (callback&&ratio)
  129.       #vertical:
  130.         set pos=min(max(the mouseV,startpos),endpos)
  131.         set the locV of sprite spritenum to pos
  132.         updateStage
  133.         set ratio=(pos-startpos)*1.0/(endpos-startpos)
  134.         if callback<>"" then do (callback&&ratio)
  135.       otherwise
  136.         alert ("The orient parameter was set to "&orient&". It can only take a value of #vertical or #horizontal (include the hash mark).")
  137.         halt
  138.     end case
  139.   end repeat
  140.   set the membernum of sprite spritenum to upcast
  141.   updateStage
  142.   return ratio
  143. end
  144.  
  145. on GetThumbRatio startpos,endpos,thumbname,orient
  146.   set orient=default(orient,#vertical)
  147.   set thumbsprite=castsprite(thumbname)
  148.   if thumbsprite<1 then
  149.     alert ("No sprite with a cast name of '"&thumbname&"' was found.  Called from 'moveThumb'.")
  150.     halt
  151.   end if
  152.   case orient of
  153.     #vertical:
  154.       set ratio=((the locV of sprite thumbsprite)-startpos)*1.0/(endpos-startpos)
  155.     #horizontal:
  156.       set ratio=((the locH of sprite thumbsprite)-startpos)*1.0/(endpos-startpos)
  157.     otherwise
  158.       alert ("The orient parameter was set to "&orient&". It can only take a value of #vertical or #horizontal (include the hash mark).")
  159.       halt
  160.   end case
  161.   return ratio
  162. end
  163.  
  164.  
  165. on moveThumb startpos,endpos,thumbname,ratio,orient
  166.   set orient=default(orient,#vertical)
  167.   set thumbsprite=castsprite(thumbname)
  168.   if thumbsprite<1 then
  169.     alert ("No sprite with a cast name of '"&thumbname&"' was found.  Called from 'moveThumb'.")
  170.     halt
  171.   end if
  172.   set ratio=min(max(ratio,0.0),1.0)
  173.   set pos=integer(startpos+(endpos-startpos)*ratio)
  174.   puppetsprite thumbsprite,true
  175.   case orient of 
  176.     #vertical:
  177.       set the locV of sprite thumbsprite to pos
  178.       updateStage
  179.     #horizontal:
  180.       set the locH of sprite thumbsprite to pos
  181.       updateStage
  182.     otherwise
  183.       alert ("The orient parameter was set to "&orient&". It can only take a value of #vertical or #horizontal (include the hash mark).")
  184.       halt
  185.   end case
  186. end
  187.  
  188. on pressScrollButton startpos,endpos,thumbname,type,callback,orient,deltapercent
  189.   set callback=default(callback,"")
  190.   case type of
  191.     #forward:
  192.       set delta=default(deltapercent,0.05)
  193.     #reverse:
  194.       set delta=-default(deltapercent,0.05)
  195.     #bed:
  196.       set delta=default(deltapercent,0.10)
  197.     otherwise
  198.       alert("The type passed into pressScrollButton was incorrectly given as "&type&".  It can only take the values #forward,#reverse, or #bed.")
  199.       halt
  200.   end case
  201.   --  put type
  202.   if (the number of member thumbname)<1 then
  203.     alert ("The thumb cast member '"&thumbname&"' was not found.Please check the pressScrollButton routine and try again.")
  204.     halt
  205.   else
  206.     set thumbsprite=castsprite(thumbname)
  207.     puppetsprite thumbsprite,true
  208.   end if
  209.   set spritenum=the clickon
  210.   puppetsprite spritenum,true
  211.   set upcast=the membernum of sprite spritenum
  212.   set upcastname=the name of member upcast
  213.   set downcast=the number of member (upcastname&"Down")
  214.   if downcast<1 then set downcast=upcast
  215.   set the membernum of sprite spritenum to downcast
  216.   updateStage
  217.   if voidP(orient) then set orient=#vertical
  218.   set ratio=getThumbRatio(startpos,endpos,thumbname,orient)
  219.   if type=#bed then
  220.     if orient=#vertical then
  221.       --      put "locV="&(the locv of sprite thumbsprite)
  222.       --      put "mouseV="&(the mousev)
  223.       if (the mouseV)<(the locV of sprite thumbsprite) then
  224.         set delta=-abs(delta)
  225.       else
  226.         set delta=abs(delta)
  227.       end if
  228.     else
  229.       if (the mouseH)<(the locH of sprite thumbsprite) then
  230.         set delta=-abs(delta)
  231.       else
  232.         set delta=abs(delta)
  233.       end if
  234.     end if
  235.   end if
  236.   --  put delta
  237.   repeat while the mousedown    
  238.     set ratio=min(max(ratio+delta,0.0),1.0)
  239.     moveThumb startpos,endpos,thumbname,ratio,orient
  240.     if callback<>"" then
  241.       do (callback&&ratio)
  242.     end if
  243.   end repeat
  244.   set the membernum of sprite spritenum to upcast
  245.   updateStage
  246.   puppetsprite spritenum,false
  247.   return ratio
  248. end 
  249.  
  250. on clearthumb thumbname
  251.   set spritenum=castspritea(thumbname)
  252.   if spritenum>0 then
  253.     if the puppet of sprite spritenum then
  254.       puppetsprite spritenum,false
  255.     end if
  256.   end if
  257. end
  258.  
  259. on scrolltext ratio
  260.   puppetsound 2,"Teletype A"
  261.   --  put ratio into field "ratio"
  262.   set lineheight=the lineheight of member "special"
  263.   set linecount=the linecount of member "special"
  264.   set pageheight=the pageheight of member "special"
  265.   set modheight=lineheight*linecount-pageheight
  266.   set pos=integer(ratio*modheight/lineheight)*lineheight
  267.   if pos>0 then
  268.     set the scrolltop of member "special" to pos
  269.   else
  270.     set the scrolltop of member "special" to 0
  271.   end if
  272. end
  273.  
  274. --on default parameter,defaultvalue
  275. --  if voidP(parameter) then
  276. --    set target=defaultvalue
  277. --  else
  278. --    set target=parameter
  279. --  end if
  280. --  return target
  281. --end
  282.  
  283. --on castsprite castname
  284. --  repeat with spritenum=1 to 48
  285. --    set castnum=the membernum of sprite spritenum
  286. --    if castnum>0 then
  287. --      if (the name  of member castnum)=castname then
  288. --        return spritenum
  289. --      end if
  290. --    end if
  291. --  end repeat
  292. --  return 0
  293. --end
  294.  
  295.