Skip to content

Language Definition

Scrivener07 edited this page Jun 29, 2019 · 8 revisions

The Papyrus language definition includes syntax highlighting, bracket matching, and snippet insertions.

Table of Contents

Syntax Highlighting

Syntax highlighting will colorize source code symbols such as types, operators, literals, functions, events, comments, and other Papyrus language constructs.

The Papyrus syntax highlighting supports VS Code Color Themes. A color theme lets you modify the colors in Visual Studio Code's user interface to suit your preferences and work environment.

Brackets

With bracket matching, bracket pairs will be highlighted as soon as the cursor is near one of them. The bracket completion will automatically insert closing symbols for appropriate language constructs.

Tip: You can jump to the matching bracket with Ctrl+Shift+\

Snippets

The extension will suggest a variety of snippets for common boiler-plate and Papyrus language keywords. This greatly increases a developers speed and productivity. To get started with snippets simply start typing its name.

The following snippets are provided.


script

Inserts a script header line.

  • scriptname: The file name of this script.
  • ScriptObject: The extending script.
Scriptname <scriptname> extends <ScriptObject>
{The documentation string.}

; code

script namespace

Inserts a script header line with Namespace. Only supported by Fallout 4.

  • namespace: The Namespace to use.
  • scriptname: The file name of this script.
  • ScriptObject: The extending script.
Scriptname <namespace>:<scriptname> extends <ScriptObject>
{The documentation string.}

; code

import

Inserts an import statement.

  • scriptname: The script or namespace to import.
import <scriptname>

comment region

Inserts a comment region into the script. This might be used to separate regions of code.

  • Region: The region label to use.
; <Region>
;---------------------------------------------

func

Inserts a function into the script.

Function Foo()
	; code
EndFunction

funcGet

Inserts a getter function into the script.

var Function GetFoo()
	var value = "type"
	; code
	return value
EndFunction

funcSet

Inserts a setter function into the script.

Function SetFoo(var argument)
	; code
EndFunction

funcFull

Inserts a full function into the script.

var Function Foobar(var argument)
	; code
	return none
EndFunction

if

Inserts an if statement into the script.

If ()

EndIf

while

Inserts a while statement into the script.

While ()

EndWhile

for

Inserts a "for loop" into the script.

int index = 0
While (index < size)
	; code
	index += 1
EndWhile

for each

Inserts a "for each in loop" into the script.

int index = 0
While (index < array.Length)
	type item = array[index]
	type

	index += 1
EndWhile

state

Inserts a state into the script.

State state

EndState

stateAuto

Inserts an auto state into the script.

Auto State state

EndState

struct

Inserts a structure into the script. Structures are only supported in Fallout 4.

Struct StructureName
	type Value
EndStruct

prop

Inserts an auto property into the script. The Mandatory is only supported in Fallout 4.

type Property PropertyName Auto Const Mandatory

propFull

Inserts a full property into the script.

type PropertyName_var
type Property PropertyName Hidden
	type Function Get()
		return PropertyName_var
	EndFunction
	Function Set(type value)
		PropertyName_var = aValue
	EndFunction
EndProperty

group

Inserts a group into the script. Groups are only supported in Fallout 4.

Group GroupName

EndGroup

groupCollapsed

Inserts a collapsed group into the script. Groups are only supported in Fallout 4.

Group GroupName Collapsed

EndGroup
Clone this wiki locally