Difference between revisions of "SetFunctionValue"
Jump to navigation
Jump to search
improved clarity
imported>Odessa (clarified, fixed typo) |
imported>Odessa (improved clarity) |
||
Line 4: | Line 4: | ||
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. | 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 <b>set</b>, and to use in a conditional, [[Eval|if eval]] rather than just <b>if</b>. | |||
|name = SetFunctionValue | |name = SetFunctionValue | ||
|returnType = None | |returnType = None | ||
Line 13: | Line 15: | ||
==Example== | ==Example== | ||
<pre> | <pre> | ||
scn MyUDF | |||
Begin Function { } | Begin Function { } | ||
Line 19: | Line 23: | ||
End | End | ||
</pre> | </pre> | ||
Then in some other script: | |||
<pre> | |||
ref rActor | |||
let rActor := call MyUDF | |||
; rActor == SunnyREF | |||
</pre> | |||
Another UDF example: | |||
<pre> | <pre> | ||
Begin Function { } | Begin Function { } | ||
Line 25: | Line 41: | ||
SetFunctionValue 1 | SetFunctionValue 1 | ||
elseif | elseif PlayerREF.GetAV Strength > 5 | ||
SetFunctionValue 1 | SetFunctionValue 1 | ||
Line 40: | Line 56: | ||
*[[User Defined Function]] | *[[User Defined Function]] | ||
*[[Call]] | *[[Call]] | ||
*[[ | *[[Let]] | ||
*[[Eval]] | *[[Eval]] | ||
[[Category:Functions_(NVSE)]] | [[Category:Functions_(NVSE)]] |