Difference between revisions of "SetFunctionValue"

Jump to navigation Jump to search
301 bytes added ,  03:20, 12 July 2014
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 eval (PlayerREF.GetAV Strength > 5)
     elseif PlayerREF.GetAV Strength > 5
         SetFunctionValue 1
         SetFunctionValue 1


Line 40: Line 56:
*[[User Defined Function]]
*[[User Defined Function]]
*[[Call]]
*[[Call]]
*[[Array Variables]]
*[[Let]]
*[[Eval]]
*[[Eval]]
[[Category:Functions_(NVSE)]]
[[Category:Functions_(NVSE)]]
Anonymous user

Navigation menu