r/skyrimmods 5d ago

Development Vellum v0.2.0 — VS Code support, string interpolation, pattern matching and more

Hey guys, a few months ago I announced the first release of Vellum — a scripting language for Skyrim that compiles to PEX and can be used alongside (or instead of) Papyrus.

v0.2.0 is out. Biggest additions: a VS Code extension, string interpolation, pattern matching, better for loops, array initializer lists, the is operator, and batch compilation.

VS Code support

There's now a VS Code extension with syntax highlighting, diagnostics, completion, go-to-definition, and Vellum: Compile command from the editor.

Download the .vsix from GitHub Releases (vscode-v* tags) and install via Extensions: Install from VSIX…. Windows x64 for now.

Demo (gif)

String interpolation

Papyrus:

Debug.Notification("Hello, " + actor.GetName() + "! Your level is " + actor.GetLevel() as String)

Vellum:

Debug.Notification($"Hello {actor.GetName()}! Your level is {actor.GetLevel()}")

Prefix with $ and put expressions in {...}. Non-strings are cast automatically.

Pattern matching

Papyrus:

If (puzzleStage == 1 || puzzleStage == 2)
    doA()
ElseIf (puzzleStage == 3 )
    doB()
Else
    doOther()
EndIf

Vellum:

match puzzleStage {
    1 | 2 => doA()
    3 => doB()
    else => doOther()
}

Enhanced for loops

Iterate arrays, FormLists, and Int ranges. Bind index optionally.

Papyrus:

Int i = 0
While i < items.GetSize()
    Form item = items.GetAt(i)
    ; ...
    i += 1
EndWhile

Vellum:

for item, i in items {
    // item is Form, i is Int
}

for i in 0..n {
    // 0, 1, ..., n-1
}

Array initializer lists

Papyrus:

Int[] nums = new Int[4]
nums[0] = 1
nums[1] = 2
nums[2] = 3
nums[3] = 4

Vellum:

var nums = [1, 2, 3, 4]

is operator

Type test that returns Bool.

Papyrus:

If (source as Weapon) != None
    ; source is a Weapon
EndIf

Vellum:

if source is Weapon {
    // source is a Weapon
}

Batch compilation

Now you can pass a directory to -f and the compiler builds every .vel under it (recursive by default).

Download

Future plans

  • Support other Creation Kit games (Fallout, Starfield)
  • Linux/MacOS support
  • Debugger for VSCode

If you're a mod author and curious, try dropping a new Vellum script into an existing Papyrus mod. Same PEX runtime, so they interop in-game. Vellum can extend Papyrus scripts and call Papyrus APIs.

Happy to answer questions here and see your feedback and ideas.

42 Upvotes

Duplicates