home *** CD-ROM | disk | FTP | other *** search
/ Greatest Childrens Stories Ever Told / Greatest_Stories.iso / movies / ripvan / shared.dir / 01010_Script_1010 < prev    next >
Text File  |  1994-11-07  |  2KB  |  91 lines

  1. --update 10/12/94 ch2/tales
  2. -- button script
  3. on doButton whichSprite,WHICHSCRIPT,keys
  4.   global keysprite,keyscript,oldcast,keyoldcastname
  5.   -- store original sprite information
  6.   set oldCast=the castNum of sprite whichSprite
  7.   set oldCastName=the name of cast oldCast
  8.   if oldcastname contains "depressed" then
  9.     -- set the castNum of sprite whichSprite=oldCastName
  10.     updatestage
  11.     beep 2
  12.     exit
  13.   else 
  14.     set newCastName=oldCastName& ", depressed"
  15.   end if
  16.   set newCast=the number of cast newCastName
  17.   set the castNum of sprite whichSprite=newCast
  18.   updateStage
  19.   
  20.   if keys then 
  21.     setkeys true,whichsprite,whichscript,newcastname
  22.     zkeyup
  23.   end if
  24.   
  25.   -- wait while the user has the button still pressed
  26.   startTimer
  27.   repeat while the timer<3 OR the stillDown
  28.     do ("nothing")
  29.   end repeat
  30.   
  31.   if not keys then 
  32.     -- restore button
  33.     if oldCastName="Text On" then
  34.       set oldCastName="Text Off"
  35.     else if oldCastName="Text Off" then
  36.       set oldCastName="Text On"
  37.     else if oldCastName="Sound On" then
  38.       set oldCastName="Sound Off"
  39.     else if oldCastName="Sound Off" then
  40.       set oldCastName="Sound On"
  41.     end if
  42.     
  43.     set oldCast=the number of cast oldCastName
  44.     set the castNum of sprite whichSprite=oldCast
  45.     updateStage
  46.   end if
  47. end
  48.  
  49. ON ZKEYUP 
  50.   global keysprite,keyscript,oldcast,keyoldcastname
  51.   if not keyscript or ((KEYSCRIPT CONTAINS "GOAHEAD") AND (frame=marker(0)+2)) then
  52.     UPDATESTAGE
  53.     abort
  54.   end if
  55.   
  56.   set oldcastname=keyoldcastname
  57.   -- restore button
  58.   if oldCastName contains "Text On" then
  59.     set oldCastName="Text Off"
  60.   else if oldCastName contains "Text Off" then
  61.     set oldCastName="Text On"
  62.   else if oldCastName contains "nomusica" then
  63.     set oldCastName="Sound Off"
  64.   else if oldCastName contains "musica" then
  65.     set oldCastName="Sound On"
  66.   end if
  67.   if oldcastname contains "depressed" then set oldCast=oldcast
  68.   else set oldCast=the number of cast oldCastName
  69.   set the castNum of sprite keySprite=oldCast
  70.   set oldcastname= the castNum of sprite keySprite
  71.   updateStage
  72.   DO keySCRIPT
  73.   setkeys false
  74. END
  75.  
  76. on setkeys a,whichsprite,whichscript,oldcastname
  77.   global keysprite,keyscript,oldcast,keyoldcastname
  78.   if a then
  79.     set keysprite=whichsprite
  80.     set keyscript=whichscript
  81.     set keyoldcastname=oldcastname
  82.   else
  83.     set keysprite=0
  84.     set keyscript=0
  85.     set oldcastname=0
  86.   end if
  87.   exit
  88. end
  89.  
  90.  
  91.