Function syntax

Jump to: navigation, search
This article is incomplete. You can help by filling in any blank descriptions.
Further information might be found in a section of the discussion page. Please remove this message when no longer necessary.


(return value) [reference].function '[argument1], [argument2], ...

Return value

The return value is a value returned by the function after it has finished with its operations. Return values can be stored in a variable for later use, see the example below.

float time

set time to GetCurrentTime


A reference is an instance of an object in the game world. Certain functions can only be executed upon references. A period (.) is used to connect the function to the reference it is executed on. This is also known as having a Calling reference "call" the function.

Warning: A Base Form may be stored in a Variable if desired, but this does not make it a reference, hence attempting to use it as the Calling reference to a function will fail and potentially cause crashes.

To make sure a Ref Variable contains a reference, follow the following script snippet:

ref rRef

if IsFormValid rRef
    if IsReference rRef
        ; * proceed


  1. IsFormValid is called first to make sure that the contents of rRef are either that of a Reference or a Base Form.
  2. Afterwards, IsReference is used to ensure rRef is a Reference.

Why not just call IsReference and ditch IsFormValid? While that may work, it's possible that NVSE may report errors if an invalid form is given to IsReference. However, IsReference seems capable of weeding out at least some invalid forms, so it may not be necessary.


The actual function.


Arguments are additional information for a function. Some are required, others are optional. All optional arguments are in italics.

If an argument can only accept certain values, they will be displayed after the variable in curly brackets. If the argument has a default value, it may also be displayed in this way.

Names and types

Return values, references and arguments can have name prefixed to their type, with a colon (:) separating them. See RemoveItem for an example.

See Also