home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 5 / boot-disc-1997-01.iso / media / utility.cst / 00009_Script_GenericClass < prev    next >
Text File  |  1996-11-05  |  3KB  |  97 lines

  1. property prefix
  2.  
  3. on new me
  4.   return me
  5. end
  6.  
  7. on clearactorlist me,classname,whichprop
  8.   repeat with index=1 to count(the actorlist)
  9.     set obj=getat(the actorlist,index)
  10.     put getobjectname(obj)
  11.     if getObjectName(obj)=classname then
  12.       put value("the "&string(whichprop)&" of obj"),value("the "&string(whichprop)&" of me")
  13.       if value("the "&string(whichprop)&" of obj")=value("the "&string(whichprop)&" of me") then
  14.         deleteat the actorlist,index
  15.         exit repeat
  16.       end if
  17.     end if
  18.   end repeat
  19. end
  20.  
  21. on getObjectName me
  22.   set oldDelimiter=the itemDelimiter
  23.   set the itemDelimiter=quote
  24.   set name=item 2 of string(me)
  25.   set the itemdelimiter=oldDelimiter
  26.   return name
  27. end
  28.  
  29. on getspritelist me,myprefix
  30.   set spritelist=[]
  31.   set prefix=myprefix
  32.   repeat with spritenum=1 to 48
  33.     set castnum=the membernum of sprite spritenum
  34.     if castnum>0 then
  35.       if offset(prefix,the name of member castnum)>0 then
  36.         add spritelist,spritenum
  37.       end if
  38.     end if
  39.   end repeat
  40.   return spritelist
  41. end
  42.  
  43. on safestring me,whichstring
  44.   set pos=offset("'",whichstring)
  45.   repeat while pos>0
  46.     put quote into char pos of whichstring
  47.     set pos=offset("'",whichstring)
  48.   end repeat
  49.   set pos=offset(";",whichstring)
  50.   repeat while pos>0
  51.     put return into char pos of whichstring
  52.     set pos=offset(";",whichstring)
  53.   end repeat
  54.   return whichstring
  55. end
  56.  
  57. on showobject me
  58.   set curtext=the scripttext of member getObjectName(me)
  59.   repeat with index=1 to the number of lines in curtext
  60.     set curline=line index of curtext
  61.     case (word 1 of curline) of 
  62.       "on","property":
  63.         put curline
  64.     end case
  65.   end repeat
  66. end
  67.  
  68. on castsprite me,whichcast
  69.   if stringP(whichcast) then
  70.     set castnum=the number of member(whichcast)
  71.   end if
  72.   if castnum<1 then return 0
  73.   set spritenum=0
  74.   repeat with index=1 to 48
  75.     set curcast=the membernum of sprite index
  76.     if curcast>0 then
  77.       if curcast=castnum then
  78.         set spritenum=index
  79.         exit repeat
  80.       end if
  81.     end if
  82.   end repeat
  83.   return spritenum
  84. end
  85.  
  86. on dispose me,classname,whichprop
  87.   clearactorlist me,classname,whichprop
  88.   --  if findpos(me,#spritenum) then
  89.   --    if the puppet of sprite spritenum then
  90.   --      set the puppet of sprite spritenum to false
  91.   --    end if
  92.   --    if not the visible of sprite spritenum then
  93.   --      set the visible of sprite spritenum to true
  94.   --    end if
  95.   return 0
  96. end
  97.