(info) This AI is still in early stages of development.

Diag()

Run a diagnostic routine...

 

Syntax

Diag(); // a string listing all diagnostic routines
 
Diag(name, params); // run a diagnostic

Parameters

ParameterTypeMandatoryNotesDiag Ver
nameString(error)

Name of the diagnostic routine.

If no name is specified, a list of all installed diagnostic routine names will be returned.

(warning) Must not contain any spaces! Will always be converted to lowercase.

0.1
paramsVariant(error)

Any additional parameters to pass in to the routine.

(warning) Note that if using the in-game chat interface they will all be stings.

0.1

Return values

ValueTypeNotesDiag Ver
<string>StringThe results of the diagnostic in a single string.0.1
<array>Array of StringThe results of the diagnostic in an array of strings.0.1
<error>String

If something goes wrong, the error message will be returned as a string.

0.1

Example

// define a diagnostic routine function
var myDiagFn = function bar(name, param1, param2, etc) {
  // name always converted to lowercase
  // do stuff
  // return either a string or an array of strings
  return "my name is "+name;
}
 
Diag.add("foo", myDiagFn); // register myDiagFn under the name "foo"

Diag("Foo", true, "bleh"); // my name is foo

Notes

See Diag.add() for notes about diagnostic routine functions.

Availability BETA

Requires:

  • Warzone 3.1 or above
  • Warzone 3.2 or above (for chat interface)
  • Diag API
Contents

Jump to:

Diag API

Topics:

  • Diag() — Run a diagnostic routine...
    • Diag.add() — Register diagnostic routines with the Diag API...
    • Diag.run() — Run a diagnostic.
  • Diag API Diagnostics — The Diag API provides a few diagnostic routines of it's own...
  • Lazy Loading Diagnostics — By lazy loading diagnostic routines, your script will start faster and use less RAM if diagnostics are not required.

Â