FaultyFalcon Posted August 12, 2016 Share Posted August 12, 2016 For anyone that can help. I am trying to call a function from a script file that i have created. The script file has the following code so far: Scriptname FaultysMenu_Components MiscObject Property MyComponent Auto constBool Property MyComponents Auto constActor Property PlayerREF Auto constFormList Property MyCompList Auto const Function AddComponents() If MyComponents == TrueInt iIndex = MyCompList.GetSize()While iIndexiIndex -= 1PlayerREF.AddItem(MyCompList.GetAt(iIndex), 100, True)EndWhileElsePlayerRef.AddItem(MyComponent, 100, True)EndIF EndFunction I am trying to access this function from a terminal menu item. My question is 1. Is the above code viable?2. What is the required syntax to attach the above function to the terminal menu item? Link to comment Share on other sites More sharing options...
TummaSuklaa Posted August 13, 2016 Share Posted August 13, 2016 The code is viable and will work as expected. To call that function, the easiest way is to make a dummy quest and make that script the quest script. Make sure it extends Quest. Then add the quest property in the terminal's fragment box. Then put this in the script field: (FaultysMenuComponentsQuest as FaultysMenuComponentsScript).AddComponents() Link to comment Share on other sites More sharing options...
scrivener07 Posted August 13, 2016 Share Posted August 13, 2016 You can create a property for your script instance directly in the calling script. ScriptName MyTerminal FaultysMenuComponentsScript Property FaultysMenuComponents Auto Const Mandatory Function Foo() FaultysMenuComponents.AddComponents() EndFunction TummaSuklaa advice also works if the script instance you need access to just so happens to be attached to a Quest. ScriptName MyTerminal Quest Property FaultysMenuComponentsQuest Auto Const Mandatory Function Foo() (FaultysMenuComponentsQuest as FaultysMenuComponentsScript).AddComponents() EndFunction Link to comment Share on other sites More sharing options...
Recommended Posts