Witcher Wiki
Substances Graveir bone
Expansion required
This article is too short to provide more than rudimentary information about the subject. You can help Witcher Wiki by expanding it.

Witcher Script (.ws) is the primary scripting language for The Witcher 3: Wild Hunt. A very large chunk of the game's logic is written in Witcher Script. Mods can override scripts and thus can drastically change game behavior. Witcher Script is a proprietary language, very similar to UnrealScript.

Features

Technically, Witcher Script is a strongly-typed, class-based object-oriented programming language, though it supports functions declared outside of the scope of classes. It uses C-like control flow with a single global namespace. Functions use pass-by-value by default for native datatypes and structs, with the keyword out indicating pass-by-reference. Pass-by-reference is used for objects. Like C, Witcher Script is free form, with semi-colons serving as statement terminators and curly brackets pairs defining groups of statements as well as scope. It is pre-compiled prior to runtime though it supports line-by-line debugging.

Witcher Script doesn't appear to have function references, though it is possible to pass function names for callbacks, though this seems limited to the engine (see implementation of Initialize in W3Class CPlayerInput for example of this).

Editors

Both Notepad++ and Script Studio are great editors for Witcher Script.

Native Datatypes

Keywords

Access Limitations

  • private
  • protected
  • public

Control Flow

  • if
  • else
  • for
  • switch
  • case
  • while
  • return
  • break
  • continue

Inheritance

  • extends
  • parent
  • virtual_parent
  • this
  • super

Boolean

  • true
  • false

Nullability

  • NULL

Declarations

  • var
  • enum
  • struct
  • function
  • event
  • class
Declaration Modifiers
  • abstract
  • statemachine
  • default
  • editable
  • const
  • import
  • final
  • timer
  • exec
  • saved
  • in
  • out
  • entry

Memory Management

  • new
  • delete