Editing User Defined Function

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 7: Line 7:
UDFs may optionally return a single value of any type, using the [[SetFunctionValue]] command within them. They may optionally accept up to 15 arguments of any type, which are defined within curly braces:
UDFs may optionally return a single value of any type, using the [[SetFunctionValue]] command within them. They may optionally accept up to 15 arguments of any type, which are defined within curly braces:
<pre>
<pre>
scn SomeUDF
int arg1 ; * args are optional
int arg1 ; * args are optional
ref arg2
ref arg2
Line 14: Line 12:


Begin Function { arg1, arg2, arg3... }
Begin Function { arg1, arg2, arg3... }
     ; * do whatever like any other script
     ; * body
End  
End  
</pre>
</pre>
and called in a similar way to regular functions:
and called in a similar way to regular functions:
<pre>
<pre>
scn SomeOtherScript
Call SomeUDF arg1, arg2, arg3...
...
call SomeUDF arg1, arg2, arg3...
</pre>


However, to assign the return to a variable, [[Let]] must be used rather than <b>set .. to ..</b>, and to use in a conditional, [[Eval|if eval]] rather than simply <b>if</b>:
let SomeVariable := Call SomeOtherUDF arg1
<pre>
let SomeVariable := call SomeOtherUDF arg1


if eval (call SomeSuitableUDF)
if eval (call SomeSuitableUDF)
Line 133: Line 126:
*[[Eval]]
*[[Eval]]
*[[Let]]
*[[Let]]
*[[Script Compiler Override]]
==External Links==
==External Links==
*[http://www.loverslab.com/topic/26802-tutorial-nvse4-part-2-user-defined-functions-udfs/ Tutorial on User Defined Functions in NVSE 4]
*[http://www.loverslab.com/topic/26802-tutorial-nvse4-part-2-user-defined-functions-udfs/ Tutorial on User Defined Functions in NVSE 4]
[[Category:NVSE]]
[[Category:NVSE]]
[[Category:User Defined Functions]]
[[Category:User Defined Functions]]

Please note that all contributions to the Fallout3 GECK Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see GECK:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Template used on this page: