home *** CD-ROM | disk | FTP | other *** search
/ Stickerpedia Stickerbook / Stickerbook.iso / pc / DATA / objects.cxt / 00011_Script_oHQ < prev    next >
Text File  |  2003-03-19  |  5KB  |  204 lines

  1. --¨
  2. oHQ
  3.  
  4.  
  5. global  oHQ
  6. global  oFileIO
  7. global  gPathDelim
  8. global  oMarvin
  9.  
  10.  
  11. property  pObjectList
  12. property  pObjectNameList
  13. property  pObjectListString
  14. property  pVersionInfoList
  15. property  pVersion
  16. property  pRunInDebugMode
  17. property  pDebugLogNum
  18. property  pDebugLogText
  19. property  pDebugLogName
  20. property  pDebugLogPath
  21. property  pPropertyDumpIDentifier
  22.  
  23.  
  24.  
  25. on new me
  26.   
  27.   pObjectList             = [] 
  28.   pObjectListString       = "[]"
  29.   pObjectNameList         = []
  30.   pDebugLogText           = ""
  31.   pDebugLogNum            = 0
  32.   pDebugLogName           = "~report_"
  33.   pDebugLogPath           = the pathname & "~debug" & gPathDelim
  34.   pPropertyDumpIDentifier = "||   "
  35.   if gPathDelim = "\" then
  36.     -- Win:
  37.     logfiles  = baFileList( pDebugLogPath, "*.log" )
  38.   else
  39.     -- Mac:
  40.     logfiles  = baFileList( pDebugLogPath, "TEXT" )
  41.   end if
  42.   pDebugLogNum = logfiles.count
  43.   
  44.   writeDebugInfo me, "----------" & return & "Log started" && the time && RETURN
  45.   
  46.   loFileIO = new(script "oFileIO")
  47.   
  48.   versionTempText   = getFile(loFileIO, #default, "~version.txt")
  49.   pVersionInfoList  = [:]
  50.   numOfLines = versionTempText.lines.count
  51.   
  52.   saveDelim = the itemDelimiter
  53.   the itemDelimiter = "="
  54.   
  55.   repeat with n = 1 to numOfLines
  56.     pVersionInfoList.addProp((versionTempText.line[n].item[1]),(versionTempText.line[n].item[2]))
  57.     tempText = tempText & pVersionInfoList[n] & RETURN
  58.   end repeat
  59.   
  60.   pRunInDebugMode = value(pVersionInfoList["debug"])
  61.   
  62.   the itemDelimiter = saveDelim
  63.   
  64.   member("versionInfo", "shared").text = versionTempText
  65.   
  66.   loFileIO = void
  67.   
  68.   -- updateProgressBar ("Object loading", oHQ && "status #ok")
  69.   addObject me
  70.   return me
  71. end
  72.  
  73.  
  74.  
  75. on debug me
  76.   pRunInDebugMode = 1  
  77.   sendAllSprites #debug
  78. end
  79.  
  80.  
  81.  
  82.  
  83. on addObject me, anObject, addToAL, newInstance
  84.   
  85.   set objectName = objectToName(me, anObject)
  86.   if newInstance or (not(offset(objectName, pObjectListString))) then
  87.     add pObjectList, anObject
  88.     set pObjectListString = string(pObjectList)
  89.     add pObjectNameList, objectName
  90.     if addToAL then
  91.       add the actorlist, anObject
  92.     end if
  93.   end if
  94. end
  95.  
  96.  
  97. on objectToName me, anObject
  98.   set objectText = string(anObject)
  99.   set objectName = char 13 to length(objectText) of objectText
  100.   set retVal = char 1 to ((offset(quote, objectName))-1) of objectName
  101.   return retVal
  102. end
  103.  
  104.  
  105. on showMyProps me
  106.   showProps me, me  
  107. end
  108.  
  109.  
  110.  
  111. on showProps me, anObject, outPutTo
  112.   put anObject
  113.   
  114.   if outPutTo = void then set outPutTo = #message
  115.   set objectName = objectToName(me, anObject)
  116.   set numOfProps = count(anObject)
  117.   
  118.   set output = RETURN
  119.   set output = output & RETURN & pPropertyDumpIDentifier & "Properties of" && objectName && anObject
  120.   set output = output & RETURN & pPropertyDumpIDentifier & "Time:" && the long time & ", " & the short date
  121.   set output = output & RETURN & pPropertyDumpIDentifier  & "Number of properties:" && numOfProps & RETURN & pPropertyDumpIDentifier
  122.   
  123.   set propList = []
  124.   repeat with n = 1 to numOfProps
  125.     add propList, (getPropAt(anObject, n) & ":" && getAt(anObject, n))
  126.   end repeat
  127.   
  128.   sort propList
  129.   
  130.   repeat with n = 1 to numOfProps
  131.     set outPut =  output & RETURN & pPropertyDumpIDentifier & getAt(propList,n)
  132.   end repeat
  133.   
  134.   case outPutTo of
  135.     #message:
  136.       put output
  137.     #file:
  138.       writeDebugInfo me, output
  139.   end case
  140.   
  141. end
  142.  
  143.  
  144.  
  145.  
  146. on clearUp me
  147.   set the actorlist  = []
  148.   set the windowList = []
  149. end
  150.  
  151.  
  152.  
  153. on deleteObject me, objectRef
  154.   
  155. end
  156.  
  157.  
  158.  
  159. on addToActorList me, anObject
  160.   add the actorlist, anObject 
  161. end
  162.  
  163.  
  164.  
  165.  
  166.  
  167. on handleError me, error, description
  168.   
  169.   
  170.   theMessage = theMessage && "Error:"       &&  error & RETURN
  171.   theMessage = theMessage && "Description:" &&  description & RETURN
  172.   
  173.   theMessage = theMessage && "Time:"        && the time & RETURN
  174.   theMessage = theMessage && "Platform:"    && the platform & RETURN
  175.   theMessage = theMessage && "Memory:"      && (checkRAM())[2] & RETURN
  176.   theMessage = theMessage && "File:"        &&  the moviename & RETURN
  177.   
  178.   if pVersionInfoList[#releasetype] <> "release" then
  179.     customAlert theMessage
  180.   end if  
  181.   
  182.   if the runMode = "author" then
  183.     put theMessage
  184.   else
  185.     writeDebugInfo me, theMessage
  186.   end if
  187.   
  188. end
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. on writeDebugInfo me, output
  196.   pDebugLogText = pDebugLogText & RETURN & output & RETURN & "----------"
  197.   writeFile oFileIO, pDebugLogPath, (pDebugLogName & doublePad(oMarvin, pDebugLogNum) & ".log" ), pDebugLogText
  198. end
  199.  
  200.  
  201.  
  202.  
  203.  
  204.