Open main menu

UESPWiki β

Set

                Set <variable> to <expression> 

       Where:   <variable>   = Local, global, or external variable to set
                <expression> = Mathematical expression which can include locals, globals
                               literal numbers, functions and the operators +, -, *, and /.

        Type:   System

     Returns:   none

     Example:   set LocalVar  to ( 3.14159 * Radius * Radius )
                set GlobalVar to ( ( player->GetStrength ) / 10 + 1 )
                set GlobalScript.LocalVar to GlobalVar
                set Object.LocalVar to ( -60 + ( GetPos, X ) / 1024 )

     Scripts:   -

Use set to store a value or expression to a variable. The expression can be a complex mathematical expression including numbers, functions, and variables. When using the set command, you should make use of spaces to surround all operators and variables. You should also surround all functions with brackets (if you do not use brackets some functions will not compile correctly).

Note that you can have multiple functions in the set expression, however they must all apply to the same object reference. For example:

        set LocalVar to ( player->GetPos, X ) + ( player->GetPos, Y )
        set LocalVar to ( player->GetPos, X ) + ( GetPos, Y )            ; Same as the previous set.
        set LocalVar to ( player->GetPos, X ) + ( aengoth->GetPos, Y )   ; Will not work; use two separate set commands.