Mod:Creation Kit/CallGlobalFunction - Utility

Member of: Mod:Creation Kit/Utility Script

Calls a global function synchronously and returns whatever that function does.

Syntax
Var Function CallGlobalFunction(string asScriptName, string asFuncName, Var[] aParams) native global

Parameters

 * asScriptName: The name of the script containing the function
 * asFuncName: The name of the function to call
 * aParams: The list of parameters to pass

Return Value
Whatever the global function returns.

Examples
Var result = Utility.CallGlobalFunction("ScriptExtender", "Exists", new Var[0]) bool exists = result as bool if (exists) Debug.Trace("We have an extender, so do something cool!") endIf Var[] params = new Var[1] params[0] = MyCoolArmor as Form ; Must cast as form by hand, even though armor is derived from form Utility.CallGlobalFunction("CoolModScript", "AddExternalItem", params)
 * Call "bool Function Exists global" on script "ScriptExtender" and make a choice based on the return value
 * Call "Function AddExternalItem(Form akItem) global" on script "CoolModScript"
 * Assume we have an armor property "MyCoolArmor" to pass off