ScriptsModel

Description

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts

Information on the scripts that are in the default scripts directory of the Interface installation. This is provided as a property of ScriptDiscoveryService.

The information provided reflects the subdirectory structure. Methods and signals are per QT's QAbstractItemModel class, with the following details:

  • A single column of data: columnCount(index) returns 1.
  • Data is provided for the following roles:
    RoleValueDescription
    Display0The directory or script file name.
    Path256The path and filename of the data item if it is a script, undefined if it is a directory.
  • Use null for the root directory's index.
Constructor
new ScriptsModel

Example

List the first 2 levels of the scripts directory.

var MAX_DIRECTORY_LEVEL = 1;
var DISPLAY_ROLE = 0;
var PATH_ROLE = 256;

function printDirectory(parentIndex, directoryLevel, indent) {
    var numRows = ScriptDiscoveryService.scriptsModel.rowCount(parentIndex);
    for (var i = 0; i < numRows; i++) {
        var rowIndex = ScriptDiscoveryService.scriptsModel.index(i, 0, parentIndex);

        var name = ScriptDiscoveryService.scriptsModel.data(rowIndex, DISPLAY_ROLE);
        var hasChildren = ScriptDiscoveryService.scriptsModel.hasChildren(rowIndex);
        var path = hasChildren ? "" : ScriptDiscoveryService.scriptsModel.data(rowIndex, PATH_ROLE);

        print(indent + "- " + name + (hasChildren ? "" : " - " + path));

        if (hasChildren && directoryLevel < MAX_DIRECTORY_LEVEL) {
            printDirectory(rowIndex, directoryLevel + 1, indent + "    ");
        }
    }
}

print("Scripts:");
printDirectory(null, 0, "");  // null index for the root directory.

Methods

Name Return Value Summary
downloadFinished None

Deprecated: This method is deprecated and will be removed from the API.

reloadDefaultFiles None

Deprecated: This method is deprecated and will be removed from the API.

reloadLocalFiles None

Deprecated: This method is deprecated and will be removed from the API.

updateScriptsLocation None

Deprecated: This method is deprecated and will be removed from the API.

Method Details

(static) downloadFinished( )

Deprecated: This method is deprecated and will be removed from the API.

(static) reloadDefaultFiles( )

Deprecated: This method is deprecated and will be removed from the API.

(static) reloadLocalFiles( )

Deprecated: This method is deprecated and will be removed from the API.

(static) updateScriptsLocation( newPath )

Deprecated: This method is deprecated and will be removed from the API.

Parameters

Name Type Description
newPath string

New path.