home *** CD-ROM | disk | FTP | other *** search
/ Hacker 7 / HACKER07.ISO / hackcd.dir / 00002_Script_ActiveButton < prev    next >
Text File  |  1998-06-09  |  12KB  |  318 lines

  1. --Arrow = 0
  2. --I-Beam = 1
  3. --Crosshair = 2
  4. --Crossbar = 3
  5. --Watch = 4
  6. --Blank = 200
  7. --Help = 254
  8. --Finger = 280
  9. --Hand = 260
  10. --Closed Hand = 290
  11. --No Drop Hand = 291
  12. --Copy Closed Hand = 292
  13. --Pencil = 256
  14. --Eraser = 257
  15. --Select = 258
  16. --Bucket = 259
  17. --Lasso = 272
  18. --Dropper = 281
  19. --Air Brush = 301
  20. --Zoom In = 302
  21. --Zoom Out = 303
  22. --Vertical Size = 284
  23. --Horizontal Size = 285
  24. --Diagonal Size = 286
  25.  
  26. property DestinationButtonName, DestinationGroupName
  27. property ButtonName, GroupName
  28. property NormalBitmap, RollOverBitmap, SelectedBitmap
  29. property RollOverSound, SelectedSound
  30. property NormalPointer, RollOverPointer, SelectedPointer
  31. property InitialState, SelectedDefault
  32. property ButtonType, ButtonControl
  33. property ApplicationPath, MovieName
  34. property FrameNumber, MarkerNumber, PlayMode, DXRMarker
  35.  
  36.  
  37. on mouseEnter me
  38.   if (the ButtonControl of me) then    
  39.     do_SetButton me, #RollOver
  40.   end if
  41. end
  42.  
  43. on mouseDown me
  44.   if (the ButtonControl of me) then
  45.     cursor (the SelectedPointer of me)
  46.   end if
  47. end
  48.  
  49. on mouseUp me
  50.   if (the ButtonControl of me) then    
  51.     do_SetButton me, #Select
  52.   end if
  53. end
  54.  
  55. on mouseLeave me
  56.   if (the ButtonControl of me) then    
  57.     do_SetButton me, #Normal
  58.   end if
  59. end
  60.  
  61. on mouseUpOutside me
  62.   if (the ButtonControl of me) then    
  63.     do_SetButton me, #Normal
  64.   end if
  65. end
  66.  
  67. on SetButton me, Addressee, state
  68.   put Addressee
  69.   put state
  70.   put the ButtonName of me
  71.   if voidP (Addressee) then
  72.     do_SetButton me, state
  73.   else
  74.     case Addressee of
  75.       #all: do_SetButton me, state
  76.       (the ButtonName of me): do_SetButton me, state
  77.       (the GroupName of me): do_SetButton me, state
  78.     end case
  79.   end if
  80. end
  81.  
  82. ---
  83. on do_SetButton me, state
  84.   case state of
  85.     #Normal:
  86.       set the member of sprite the spriteNum of me to the member of the NormalBitmap of me
  87.       
  88.       if (the ButtonControl of me) then
  89.         cursor the NormalPointer of me
  90.       end if
  91.       
  92.       if (the ButtonControl of me) and (the DestinationButtonName of me <> EMPTY) then
  93.         sendAllSprites #SetButton, symbol (the DestinationButtonName of me), #Normal
  94.       end if
  95.       
  96.       if (the ButtonControl of me) and (the DestinationGroupName of me <> EMPTY) then
  97.         sendAllSprites #SetButton, symbol (the DestinationGroupName of me), #Normal
  98.       end if
  99.       
  100.     #RollOver:
  101.       set the member of sprite the spriteNum of me to the member of the RollOverBitmap of me
  102.       
  103.       if (the ButtonControl of me) then
  104.         cursor the RollOverPointer of me
  105.         puppetSound the RollOverSound of me
  106.       end if
  107.       
  108.       if (the ButtonControl of me) and (the DestinationButtonName of me <> EMPTY) then
  109.         sendAllSprites #SetButton, symbol (the DestinationButtonName of me), #RollOver
  110.       end if
  111.       
  112.       if (the ButtonControl of me) and (the DestinationGroupName of me <> EMPTY) then
  113.         sendAllSprites #SetButton, symbol (the DestinationGroupName of me), #RollOver
  114.       end if
  115.       
  116.     #Select:
  117.       if not (the ButtonType of me) then
  118.         set the member of sprite the spriteNum of me to the member of the RollOverBitmap of me
  119.       else
  120.         set the member of sprite the spriteNum of me to the member of the SelectedBitmap of me
  121.       end if
  122.       
  123.       if (the ButtonControl of me) then
  124.         cursor the NormalPointer of me
  125.         puppetSound the SelectedSound of me
  126.         
  127.         if (the ButtonControl of me) and (the DestinationButtonName of me <> EMPTY) then
  128.           sendAllSprites #SetButton, symbol (the DestinationButtonName of me), #Select
  129.         else if (the ButtonControl of me) and (the DestinationGroupName of me <> EMPTY) then
  130.           sendAllSprites #SetButton, symbol (the DestinationGroupName of me), #Select
  131.         end if
  132.         if not voidP (the ApplicationPath of me) then
  133.           put the ApplicationPath of me
  134.           open (the ApplicationPath of me)
  135.           
  136.           if (the PlayMode of me) = #"Return" then
  137.             play done
  138.           else
  139.             if (the MovieName of me) <> EMPTY then
  140.               set the MovieName of me = get_filename(MovieName)
  141.               if (the DXRMarker of me) <> EMPTY then
  142.                 go (the DXRMarker of me) of movie (the MovieName of me)
  143.               else
  144.                 case (PlayMode) of:
  145.                   #"Go to":
  146.                     go to movie (the MovieName of me)
  147.                   #"Play and Return":
  148.                     play movie (the MovieName of me)
  149.                 end case
  150.               end if
  151.             end if
  152.             
  153.             if (the FrameNumber of me) <> 0 then
  154.               case (PlayMode) of:
  155.                 #"Go to":
  156.                   go to frame(the FrameNumber of me)
  157.                 #"Play and Return":
  158.                   play frame (the FrameNumber of me)
  159.               end case
  160.             end if
  161.             
  162.             if (the MarkerNumber of me) <> #loop then
  163.               if the PlayMode of me = #"Go to" then
  164.                 case (MarkerNumber) of:
  165.                   #Previous: go to marker(-1)
  166.                   #Loop:     go to marker(0)
  167.                   #Next:     go to marker(1)
  168.                   otherwise:
  169.                     go to MarkerNumber
  170.                 end case
  171.               else
  172.                 case (MarkerNumber) of:
  173.                   #Previous: play marker( -1 )
  174.                   #Loop:     play marker(  0 )
  175.                   #Next:     play marker(  1 )
  176.                   otherwise:
  177.                     play MarkerNumber    
  178.                 end case
  179.               end if
  180.             end if
  181.           end if
  182.         end if
  183.       end if
  184.   end case 
  185. end
  186.  
  187. on get_filename f_name
  188.   -- don't force user to remember the extension
  189.   if NOT ( f_name contains ".dxr" ) then
  190.     set f_name = f_name & ".dxr"
  191.   end if
  192.   -- support relative pathnames
  193.   if (( f_name contains "/" ) OR ¼
  194.       ( f_name contains "\" )) then
  195.     if ( NOT f_name contains ":" ) then
  196.       set f_name = the pathname & f_name
  197.     end if
  198.   end if
  199.   return( f_name )
  200. end
  201.  
  202. ---
  203.  
  204. on BeginSprite me
  205.   set the ButtonName of me to symbol (the ButtonName of me)
  206.   set the GroupName of me to symbol (the GroupName of me)
  207.   
  208.   set the NormalBitmap of me = the member of sprite (the spriteNum of me) 
  209. end
  210.  
  211. on getPropertyDescriptionList
  212.   if the currentspritenum = 0 then 
  213.     set memdefault = 0 
  214.   else
  215.     set memref = the member of sprite the currentspritenum
  216.     set castlibnum = the castlibnum of memref
  217.     
  218.     set RollOverBitmapDefault to the name of member (the membernum of member memref) of castlib castlibnum
  219.     set RollOverBitmapDefault to "RollOver" && RollOverBitmapDefault
  220.     
  221.     set SelectedBitmapDefault to the name of member (the membernum of member memref) of castlib castlibnum
  222.     set SelectedBitmapDefault to "Selected" && SelectedBitmapDefault
  223.     
  224.     set RollOverSoundDefault to "RollOver Sound"
  225.     set SelectedSoundDefault to "Selected Sound"
  226.     
  227.   end if
  228.   
  229.   set ButtonPropertyList = [ ¼
  230.               #ButtonName: [ #comment: "Ime Gumba:", ¼
  231.                              #format:  #symbol, ¼
  232.                              #default: #""], ¼
  233.                #GroupName: [ #comment: "Ime grupe kojoj gumb pripada:", ¼
  234.                              #format:  #symbol, ¼
  235.                              #default: #""], ¼
  236.           #RollOverBitmap: [ #comment: "Slika za oznaceni gumb:", ¼
  237.                              #format:  #graphic, ¼
  238.                              #default: RollOverBitmapDefault], ¼
  239.           #SelectedBitmap: [ #comment: "Slika za selektirani gumb:", ¼
  240.                              #format:  #graphic, ¼
  241.                              #default: SelectedBitmapDefault], ¼
  242.            #RollOverSound: [ #comment: "Zvuk za oznaceni gumb:", ¼
  243.                              #format:  #sound, ¼
  244.                              #default: RollOverSoundDefault], ¼
  245.            #SelectedSound: [ #comment: "Zvuk za selektirani gumb:", ¼
  246.                              #format:  #sound, ¼
  247.                              #default: SelectedSoundDefault], ¼
  248.            #NormalPointer: [ #comment: "Normalni pointer:", ¼
  249.                              #format:  #cursor, ¼
  250.                              #default: 0], ¼
  251.          #RollOverPointer: [ #comment: "Pointer za oznaceni gumb:", ¼
  252.                              #format:  #cursor, ¼
  253.                              #default: 280], ¼
  254.          #SelectedPointer: [ #comment: "Pointer za selektirani gumb:", ¼
  255.                              #format:  #cursor, ¼
  256.                              #default: 290], ¼
  257.             #InitialState: [ #comment: "Pocetno stanje je oznaceno", ¼
  258.                              #format:  #boolean, ¼
  259.                              #default: FALSE ], ¼
  260.               #ButtonType: [ #comment: "Gumb sa 3 stanja?", ¼
  261.                              #format:  #boolean, ¼
  262.                              #default: TRUE ], ¼
  263.            #ButtonControl: [ #comment: "Gumb ima vlastiti handler?", ¼
  264.                              #format:  #boolean, ¼
  265.                              #default: TRUE ], ¼
  266.    #DestinationButtonName: [ #comment: "Ime gumba kojem ide poruka:", ¼
  267.                              #format:  #symbol, ¼
  268.                              #default: #""], ¼
  269.     #DestinationGroupName: [ #comment: "Ime grupe kojoj ide poruka:", ¼
  270.                              #format:  #symbol, ¼
  271.                              #default: #""], ¼
  272.         #ApplicationPath: [ #comment: "Putanja do programa:", ¼
  273.                              #format:  #string, ¼
  274.                              #default: ""], ¼
  275.                #MovieName: [ #comment: "Putanja do DXR datoteke:", ¼
  276.                              #format:  #string, ¼
  277.                              #default: ""], ¼
  278.                #DXRMarker: [ #comment: "Marker u DXR datoteci:", ¼
  279.                              #format:  #string, ¼
  280.                              #default: ""], ¼
  281.                 #PlayMode: [ #comment: "Play Mode:", ¼
  282.                              #format:  #symbol, ¼
  283.                              #range:   [ #"Go to", #"Play and Return", #"Return" ], ¼
  284.                              #default: #"Play and Return" ], ¼
  285.              #FrameNumber: [ #comment: "Skoci na frame broj:", ¼
  286.                              #format:  #integer, ¼
  287.                              #default: 0 ], ¼
  288.             #MarkerNumber: [ #comment: "Skoci na oznaku:", ¼
  289.                              #format:  #marker, ¼
  290.                              #default: #loop ] ¼
  291.   ]
  292.   
  293.   return ButtonPropertyList  
  294.   
  295. end
  296.  
  297.  
  298. on getBehaviorDescription
  299.   return ¼
  300. "Switches cast members when the SwitchStates message is received. Switches to a particular state when the SetState message is received. Enter a Group ButtonName to include the current sprite in a group of sprites that respond to the same message. " & RETURN & ¼
  301. "PARAMETERS:" & RETURN & ¼
  302. "ò Item ButtonName - (optional) Enter an item ButtonName to identify the current sprite so that it can receive a specific message. Do not use spaces. Use the ButtonName as an argument for the Message Sprite or Message All Sprites behaviors."  & RETURN & ¼
  303. "ò Alternate Image - number of castmember whose image will replace normal image.  Must be stored in same cast library as Normal castmember."  & RETURN & ¼
  304. "ò Initially Toggled - Turn this option on if sprite's current cast member represents the alternate rather than the normal state of the sprite."  & RETURN & ¼
  305. "ò Group ButtonName - (optional) Enter a Group ButtonName to include the current sprite in a group of sprites that respond to the same message. Do not use spaces. Use the ButtonName as an argument for the Message Sprite or Message All Sprites behaviors."  & RETURN & ¼
  306. "MESSAGES:" & RETURN & ¼
  307. "ò SwitchStates [ID] - Switches the sprite's cast member. ID is the Item ButtonName or Group ButtonName of the sprite. Returns the current state of the sprite, 0 (normal) or 1 (alternate)."& RETURN & ¼
  308. "ò SetState {0 or 1}, [ID] - Sets the sprite to state 0 (normal) or 1 (alternate). ID is the Item ButtonName or Group ButtonName of the sprite. If the ID is omitted any sprite receiving the message will SetState."
  309.   
  310. end
  311.  
  312.  
  313.  
  314. on getAssocMembers --added, fmk
  315.   set myPropList = [RollOverBitmap ]
  316.   
  317.   return myPropList
  318. end getAssocMembers