A function added by the New Vegas Script Extender.


Added by NVSE V4, let is used for variable assignments and is best thought of as a more powerful version of the vanilla set .. to .. command.

Compared to set, it has the following advantages:

  • It supports a wider range of operators, such as += and -= for convenietly incrementing or decrementing numeric variables.
  • It supports array variables, string variables and user defined functions.
  • When an assignment fails, a runtime error message is printed to the console, naming the guilty mod and script, and the script will continue to run. By comparison, set will cause the script to fail silently, and so is harder to debug.


(assignment) let Variable:Any Operator:Any Value:Any


Simple assignments:

ref MyRef
int MyInt

let MyInt := 5        ; equivalent to 'set MyInt to 5'
let MyRef := SunnyREF ; equivalent to 'set MyRef to SunnyREF'

Incrementing, etc

let MyInt := 5  ; 'set MyInt to 5'
let MyInt += 1  ; 'set MyInt to MyInt + 1'
let MyInt *= 10 ; 'set MyInt to MyInt * 10'
let MyInt /= 5  ; 'set MyInt to MyInt / 5'

let MyVeryLongNamedQuest.SomeVariable += 1 'set MyVeryLongNamedQuest.SomeVariable to MyVeryLongNamedQuest.SomeVariable + 1'

Strings, arrays and UDFs:

string_var my_string
array_var Beatles
int FoodCount

let my_string := "string variables are great"
let my_string += " and you can concatanate them with += too!"

let Beatles := Ar_List JohnREF, PaulREF, GeorgeREF, RingoREF

let Beatles[3] := KeithMoonREF ; swap element 3 (RingoREF for KeithMoonREF, probably a bad move ;))

let MyRef := Beatles[0] ; first element is 0, so MyRef == JohnREF

let FoodCount := call MyFoodCountingUDF PlayerREF ; call a UDF

See Also

External Links

Personal tools