SetFunctionValue
From GECK
A function added by the New Vegas Script Extender.
Contents
Description
Used only within the 'Function' block type of a User Defined Function, sets the return value to that specified. A UDF may return only a single value, but it may be of any type, including an array.
If the function is called multiple times in the same function, the most recent is used by the call; this function is not a substitute for the keyword 'return', script execution will continue to the end of the block as normal.
In another script, to bind the UDF function value to a variable, Let must be used rather than set, and to use in a conditional, if eval rather than just if.
Syntax
(None) SetFunctionValue UDFReturnValue:multi
Example
scn MyUDF Begin Function { } SetFunctionValue SunnyREF ; * this function simply returns Sunny Smiles End
Then in some other script:
ref rActor let rActor := call MyUDF ; rActor == SunnyREF
Another UDF example:
Begin Function { } if GameHour > 12 SetFunctionValue 1 elseif PlayerREF.GetAV Strength > 5 SetFunctionValue 1 else SetFunctionValue 0 endif ; * return true if it is after midday or player has more than 5 strength End