githubEdit

WScript API Documentation

WScript API Documentation

circle-info

The following method list is auto-generated from WolvenKit Source.

Overview

AppScriptFunctions

TODO.

Method
Description

Turn on/off updates to the project tree, useful for when making lots of changes to the project structure.

Add the specified CR2WFile or IGameFile file to the project.

Save the specified text to the specified path in the raw folder.

Save the specified text to the specified path in the resources folder.

Loads the content of a text file from resources.

Loads the specified game file from the project files rather than game archives.

Loads the specified json file from the project raw files rather than game archives.

Retrieves a list of files from the project.

Clears the lookup for exported depot files.

Exports a list of files as you would with the export tool.

Loads a file from the project using either a file path or hash.

Loads a file from the project or archive (in this order) using either a file path or hash.

Check if file exists in the project.

Check if file exists in either the game archives or the project.

Check if file exists in the project Raw folder.

Deletes a file from the project, if it exists.

Loads all records as TweakDBID paths.

Loads all flats as TweakDBID paths.

Loads all queries as TweakDBID paths.

Loads all group tags as TweakDBID paths.

Loads a record by its TweakDBID path.

Loads a flat by its TweakDBID path.

Loads flats of a query by its TweakDBID path.

Loads a group tag by its TweakDBID path.

Whether TweakDBID path exists as a flat or a record?

Tries to get TweakDBID path from its hash.

Displays a message box.

Extracts a file from the base archive and adds it to the project.

Gets the current active document from the docking manager.

Gets all documents from the docking manager.

Opens a file in WolvenKit .

Exports an geometry_cache entry.

Creates a new instance of the given class, and returns it converted to a JSON string.

Returns the hashcode for a given string.

Pauses the execution of the script for the specified amount of milliseconds.

Returns the current wolvenkit version.

Shows the settings dialog for the supplied data.

No description available.

No description available.

No description available.

No description available.

No description available.

No description available.

ScriptDocumentWrapper

TODO.

Method
Description

Gets the game file.

Saves the document.

Reloads the document.

Closes the document without saving.

ScriptFunctions

TODO.

Method
Description

Gets a list of the files available in the game archives Note to myself: Don't use IEnumerable

DEPRECATED: Please use GetFileFromArchive(path, OpenAs.GameFile) Loads a file from the base archives using either a file path or hash.

Creates a json representation of the specifed game file.

Creates a CR2W game file from a json.

Changes the extension of the provided string path.

Loads a file from the base archives using either a file path or hash.

Check if file exists in the game archives.

Converts a YAML string to a JSON string.

Converts a JSON string to a YAML string.

No description available.

UiScriptFunctions

Method
Description

No description available.


Detailed Documentation

AppScriptFunctions

TODO.

SuspendFileWatcher

Turn on/off updates to the project tree, useful for when making lots of changes to the project structure.

Parameter
Description

suspend

bool for if updates are suspended


SaveToProject

Add the specified CR2WFile or IGameFile file to the project.

Parameter
Description

path

The file to write to

file

CR2WFile or IGameFile to be saved


SaveToRaw

Save the specified text to the specified path in the raw folder.

Parameter
Description

path

The file to write to

content

The string to write to the file


SaveToResources

Save the specified text to the specified path in the resources folder.

Parameter
Description

path

The file to write to

content

The string to write to the file


LoadFromResources

Loads the content of a text file from resources.

Parameter
Description

path

The relative path of the text file

Returns: The content or null


LoadGameFileFromProject

Loads the specified game file from the project files rather than game archives.

Parameter
Description

path

The file to open for reading

type

The type of the object which is returned. Can be "cr2w" or "json"


LoadRawJsonFromProject

Loads the specified json file from the project raw files rather than game archives.

Parameter
Description

path

The file to open for reading

type

The type of the object which is returned. Can be "cr2w" or "json"


GetProjectFiles

Retrieves a list of files from the project.

Parameter
Description

folderType

string parameter folderType = "archive" or "raw"


ClearExportFileLookup

Clears the lookup for exported depot files.


ExportFiles

Exports a list of files as you would with the export tool.

Parameter
Description

fileList

defaultSettings

blocking


GetFileFromProject

Loads a file from the project using either a file path or hash.

Parameter
Description

path

The path of the file to retrieve

openAs

The output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)


GetFileFromProject

Loads a file from the project using either a file path or hash.

Parameter
Description

hash

The hash of the file to retrieve

openAs

The output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)


GetFile

Loads a file from the project or archive (in this order) using either a file path or hash.

Parameter
Description

path

The path of the file to retrieve

openAs

The output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)


GetFile

Loads a file from the project or archive (in this order) using either a file path or hash.

Parameter
Description

hash

The hash of the file to retrieve

openAs

The output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)


FileExistsInProject

Check if file exists in the project.

Parameter
Description

path

file path to check


FileExistsInProject

Check if file exists in the project.

Parameter
Description

hash

hash value to be checked


FileExists

Check if file exists in either the game archives or the project.

Parameter
Description

path

file path to check


FileExists

Check if file exists in either the game archives or the project.

Parameter
Description

hash

hash value to be checked


FileExistsInRaw

Check if file exists in the project Raw folder.

Parameter
Description

filepath

relative filepath to be checked


DeleteFile

Deletes a file from the project, if it exists.

Parameter
Description

filepath

relative filepath to be deleted

folderType

project subfolder type (archive|raw|resources)

Returns: true if the file was deleted


GetRecords

Loads all records as TweakDBID paths.


GetFlats

Loads all flats as TweakDBID paths.


GetQueries

Loads all queries as TweakDBID paths.


GetGroupTags

Loads all group tags as TweakDBID paths.


GetRecord

Loads a record by its TweakDBID path.

Parameter
Description

path

Returns: record as a JSON string, null when not found


GetFlat

Loads a flat by its TweakDBID path.

Returns: flat as a JSON string, null when not found


GetQuery

Loads flats of a query by its TweakDBID path.

Returns: a list of flats as TweakDBID paths, empty when not found


GetGroupTag

Loads a group tag by its TweakDBID path.

Returns: flat as a JSON string, null when not found


HasTDBID

Whether TweakDBID path exists as a flat or a record?

Parameter
Description

path


GetTDBIDPath

Tries to get TweakDBID path from its hash.

Parameter
Description

key

Returns: path of the hash, null when undefined


ShowMessageBox

Displays a message box.

Parameter
Description

text

A string that specifies the text to display.

caption

A string that specifies the title bar caption to display.

image

A WMessageBoxImage value that specifies the icon to display.

buttons

A WMessageBoxButtons value that specifies which buttons to display.

Returns: A WMessageBoxResult value that specifies the result the message box button that was clicked by the user returned.


Extract

Extracts a file from the base archive and adds it to the project.

Parameter
Description

path

Path of the game file


GetActiveDocument

Gets the current active document from the docking manager.


GetDocuments

Gets all documents from the docking manager.


OpenDocument

Opens a file in WolvenKit .

Parameter
Description

path

Path to the file

Returns: Returns true if the file was opened, otherwise it returns false


OpenDocument

Opens an archive game file.

Parameter
Description

gameFile

The game file to open


ExportGeometryCacheEntry

Exports an geometry_cache entry.

Parameter
Description

sectorHashStr

Sector hash as string

entryHashStr

Entry hash as string


CreateInstanceAsJSON

Creates a new instance of the given class, and returns it converted to a JSON string.

Parameter
Description

className

Name of the class


HashString

Returns the hashcode for a given string.

Parameter
Description

data

String to be hashed

method

Hash method to use. Can be "fnv1a64" or "default" (Uses the String objects built in hash function)


Sleep

Pauses the execution of the script for the specified amount of milliseconds.

Parameter
Description

milliseconds

The number of milliseconds to sleep.


ProgramVersion

Returns the current wolvenkit version.


ShowSettings

Shows the settings dialog for the supplied data.

Parameter
Description

data

A JavaScript object containing data

Returns: Returns true when the user changed the settings, otherwise it returns false


SaveAs


GetBaseFolder


ParseExportSettings


GetGlobalExportArgs


ConvertTDBToPath


ConvertTDBToJson


ScriptDocumentWrapper

TODO.

GetGameFile

Gets the game file.

Parameter
Description

type

The output type of the game file ("cr2w" or "json")


Save

Saves the document.


Reload

Reloads the document.

Parameter
Description

force

If force is true, any unsaved changes will be discarded


Close

Closes the document without saving.


ScriptFunctions

TODO.

GetArchiveFiles

Gets a list of the files available in the game archives Note to myself: Don't use IEnumerable


GetFileFromBase

DEPRECATED: Please use GetFileFromArchive(path, OpenAs.GameFile) Loads a file from the base archives using either a file path or hash.

Parameter
Description

path

The path of the file to retrieve


GetFileFromBase

DEPRECATED: Please use GetFileFromArchive(hash, OpenAs.GameFile) Loads a file from the base archives using either a file path or hash.

Parameter
Description

hash

The hash of the file to retrieve


GameFileToJson

Creates a json representation of the specifed game file.

Parameter
Description

gameFile

The gameFile which should be converted


JsonToCR2W

Creates a CR2W game file from a json.

Parameter
Description

json


ChangeExtension

Changes the extension of the provided string path.

Parameter
Description

path

The path of the file to change

extension


GetFileFromArchive

Loads a file from the base archives using either a file path or hash.

Parameter
Description

path

The path of the file to retrieve

openAs

The output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)


GetFileFromArchive

Loads a file from the base archives using either a file path or hash.

Parameter
Description

hash

The hash of the file to retrieve

openAs

The output format (OpenAs.GameFile, OpenAs.CR2W or OpenAs.Json)


FileExistsInArchive

Check if file exists in the game archives.

Parameter
Description

path

file path to check


FileExistsInArchive

Check if file exists in the game archives.

Parameter
Description

hash

hash value to be checked


YamlToJson

Converts a YAML string to a JSON string.

Parameter
Description

yamlText

The YAML string to convert

Returns: The converted JSON string


JsonToYaml

Converts a JSON string to a YAML string.

Parameter
Description

jsonText

The JSON string to convert

Returns: The converted YAML string


ConvertGameFile


UiScriptFunctions

AddMenuItem

Parameter
Description

target

name


AddMenuItem

Parameter
Description

target

name

onClick


AddMenuItem

Parameter
Description

target

name

onClick

args


AddMenuItem

Parameter
Description

target

name

onClick

args


Last updated

Was this helpful?