githubEdit

WScript API Documentation

circle-info

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

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

SuspendFileWatcher(suspend: bool)void

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

SaveToProject(path: string, file: object)void

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

SaveToRaw(path: string, content: string)void

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

SaveToResources(path: string, content: string)void

Loads the content of a text file from resources.

Parameter
Description

path

The relative path of the text file

Returns: The content or null


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"


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"


Retrieves a list of files from the project.

Parameter
Description

folderType

string parameter folderType = "archive" or "raw"


Clears the lookup for exported depot files.


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

Parameter
Description

fileList

defaultSettings

blocking


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)


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)


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)


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)


Check if file exists in the project.

Parameter
Description

path

file path to check


Check if file exists in the project.

Parameter
Description

hash

hash value to be checked


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

Parameter
Description

path

file path to check


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

Parameter
Description

hash

hash value to be checked


Check if file exists in the project Raw folder.

Parameter
Description

filepath

relative filepath to be checked


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


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.

Parameter
Description

path

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


Loads a flat by its TweakDBID path.

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


Loads flats of a query by its TweakDBID path.

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


Loads a group tag by its TweakDBID path.

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


Whether TweakDBID path exists as a flat or a record?

Parameter
Description

path


Tries to get TweakDBID path from its hash.

Parameter
Description

key

Returns: path of the hash, null when undefined


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.


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

Parameter
Description

path

Path of the game file


Gets the current active document from the docking manager.


Gets all documents from the docking manager.


Opens a file in WolvenKit .

Parameter
Description

path

Path to the file

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


Opens an archive game file.

Parameter
Description

gameFile

The game file to open


Exports an geometry_cache entry.

Parameter
Description

sectorHashStr

Sector hash as string

entryHashStr

Entry hash as string


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

Parameter
Description

className

Name of the class


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)


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

Parameter
Description

milliseconds

The number of milliseconds to sleep.


Returns the current wolvenkit version.


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








Gets the game file.

Parameter
Description

type

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


Saves the document.


Reloads the document.

Parameter
Description

force

If force is true, any unsaved changes will be discarded


Closes the document without saving.


Parameter
Description

target

name


Parameter
Description

target

name

onClick


Parameter
Description

target

name

onClick

args


Parameter
Description

target

name

onClick

args


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.

Parameter
Description

path

The path of the file to retrieve


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


Creates a json representation of the specifed game file.

Parameter
Description

gameFile

The gameFile which should be converted


Creates a CR2W game file from a json.

Parameter
Description

json


Changes the extension of the provided string path.

Parameter
Description

path

The path of the file to change

extension


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)


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)


Check if file exists in the game archives.

Parameter
Description

path

file path to check


Check if file exists in the game archives.

Parameter
Description

hash

hash value to be checked


Converts a YAML string to a JSON string.

Parameter
Description

yamlText

The YAML string to convert

Returns: The converted JSON string


Converts a JSON string to a YAML string.

Parameter
Description

jsonText

The JSON string to convert

Returns: The converted YAML string



Last updated

Was this helpful?