dzik

Diablo 2 - ETAL - Dump Core Functions

Sep 2nd, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function NTMain()
  2. {
  3.     Delay(1000);
  4.  
  5.     var filehandle = FileOpen("drumpProps.txt", 1);
  6.     if(filehandle)
  7.     {
  8.         filehandle.WriteLine(dumpProps(this));
  9.         filehandle.Close();
  10.     }
  11.     Print("ΓΏc2file created");
  12.  
  13.     Delay(200000);
  14.     Say('Next Game!');
  15.     Delay(200);
  16.  
  17.     ExitGame();
  18. }
  19.  
  20.  
  21. // credits to Thomas McDonald
  22. // modded by D2oD to indent objects and return the whole dump in a string.
  23. function dumpProps(obj, parent) {
  24.    // Go through all the properties of the passed-in object
  25.    var result = "";
  26.    for (var i in obj) {
  27.       // if a parent (2nd parameter) was passed in, then use that to
  28.       // build the message. Message includes i (the object's property name)
  29.       if(parent) { var msg = parent +"."+i+" => "+(typeof obj[i])+"\n"; } else { var msg = "\n"+i + " => " + (typeof obj[i])+"\n"; }
  30.       result += msg;
  31.       // then the object's property value
  32.       if (typeof obj[i] == "object") {
  33.         if(parent) { result += dumpProps(obj[i], parent +"."+i); } else { result += dumpProps(obj[i], "  "); }
  34.       }
  35.    }
  36.    return result;
  37. }
Add Comment
Please, Sign In to add comment