Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump generation #1

Open
MNoya opened this issue Aug 27, 2016 · 1 comment
Open

Dump generation #1

MNoya opened this issue Aug 27, 2016 · 1 comment

Comments

@MNoya
Copy link
Contributor

MNoya commented Aug 27, 2016

  • cl_panorama_script_help_2 (Crashes the game currently)
  • script_help2
  • cl_script_help2
  • dump_panorama_css_properties
  • dump_panorama_events
function DumpObjectIndented(obj, indent)
{
  var result = "";
  if (indent == null) indent = "";

  for (var property in obj)
  {
    var value = obj[property];
    if (typeof value == 'string')
      value = "'" + value + "'";
    else if (typeof value == 'object')
    {
      if (value instanceof Array)
      {
        // Just let JS convert the Array to a string!
        value = "[ " + value + " ]";
      }
      else
      {
        // Recursive dump
        // (replace "  " by "\t" or something else if you prefer)
        var od = DumpObjectIndented(value, indent + "  ");
        // If you like { on the same line as the key
        //value = "{\n" + od + "\n" + indent + "}";
        // If you prefer { and } to be aligned
        value = "\n" + indent + "{\n" + od + "\n" + indent + "}";
      }
    }
    result += indent + "'" + property + "' : " + value + ",\n";
  }
  return result.replace(/,\n$/, "");
}
@SinZ163
Copy link
Member

SinZ163 commented Aug 29, 2016

Pushed enumdump.ts and DefinitionGenerator.py from ModDota/DotaUI to this repo.

  • enumdump.ts generates dota_enum.d.ts and for all intents and purposes is a refined version of OP's function, but it will only spit out constants, and also adds the file header at the top.
  • DefinitionGenerator.py accepts input from cl_panorama_script_help $TYPE and spits out vaguely typescript declaration that a human needs to go through later and clean up (Valves documentation is very vague on a lot of types)

Calling all @ModDota/panorama to inspect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants