draco1122 Posted April 29, 2017 Share Posted April 29, 2017 I have two script fragments I am trying to get to work. Goal is to make terminal exit then open container. I have Force withdraw check but that didn't work. Terminal stays open. RegisterForMenuOpenCloseEvent("Exit") OnMenuOpenCloseEvent(TerminalMenu asMenuName, close abOpening) if (asMenuName== "Exit") if (abOpening) aaadWeaponAmmoBin.Activate(Game.GetPlayer()) OR RegisterForMenuOpenCloseEvent("Exit") OnMenuOpenCloseEvent(TerminalMenu asMenuName, close abOpening) aaadWeaponAmmoBin.Activate(Game.GetPlayer()) Error is Fragments\Terminals\TERM_aaadWeaponsTerminalSubM_0103F3C7.psc(16,34): no viable alternative at input 'asMenuName' Fragments\Terminals\TERM_aaadWeaponsTerminalSubM_0103F3C7.psc(16,61): required (...)+ loop did not match anything at input ')' Exit = my terminal Link to comment Share on other sites More sharing options...
draco1122 Posted April 29, 2017 Author Share Posted April 29, 2017 Here where I got the script so far. https://www.creationkit.com/fallout4/index.php?title=OnMenuOpenCloseEvent_-_ScriptObject Link to comment Share on other sites More sharing options...
scrivener07 Posted April 29, 2017 Share Posted April 29, 2017 Theres so many things wrong with the script you posted above that I dont even know where to start. I dont think you can force close a terminal via script, this is done by pressing TAB on the terminals top level. Also "Force withdraw" is not a thing. In skyrim with SKSE you could fake the TAB key press but that IS NOT the case in Fallout 4. http://www.creationkit.com/index.php?title=TapKey_-_Input Link to comment Share on other sites More sharing options...
draco1122 Posted April 30, 2017 Author Share Posted April 30, 2017 (edited) K, miss read the force withdraw. Not, sure at this point if it is even possible to do what I want with a terminal. Problem was it was opening the container while the in the terminal. It would have the player controls still controlling the menu in the terminal and not the container. I am new to scripting in some ways and others not. Is their a place with acceptable functions or commands? Or a way for the script to run after you close the terminal? Edited April 30, 2017 by draco1122 Link to comment Share on other sites More sharing options...
Lisselli Posted April 30, 2017 Share Posted April 30, 2017 That very event is what you would use after the terminal is closed, it just can't be used to force close one.Try this and don't forget to register the event:Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) if asMenuName == "TerminalMenu" if abOpening == false ; do stuff endif endif endEvent Link to comment Share on other sites More sharing options...
draco1122 Posted April 30, 2017 Author Share Posted April 30, 2017 (edited) That very event is what you would use after the terminal is closed, it just can't be used to force close one. Try this and don't forget to register the event: Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) if asMenuName == "TerminalMenu" if abOpening == false ; do stuff endif endif endEvent K, problem I am having is under script fragments I can't use a event. Now using this script. RegisterForMenuOpenCloseEvent(TerminalMenu)OnMenuOpenCloseEvent(string asMenuName, bool abOpening)if asMenuName == "TerminalMenu" if abOpening == false aaadWeaponAmmoBin.Activate(Game.GetPlayer()) endifendifIt registers the event how ever I get this compiling error when I add this line OnMenuOpenCloseEvent(string asMenuName, bool abOpening) I get this error message.Compiling "Fragments:Terminals:TERM_aaadWeaponsTerminalSubM_0103F3C7"...PapyrusTemp\Fragments\Terminals\TERM_aaadWeaponsTerminalSubM_0103F3C7.psc(16,21): mismatched input 'string' expecting RPARENPapyrusTemp\Fragments\Terminals\TERM_aaadWeaponsTerminalSubM_0103F3C7.psc(16,38): required (...)+ loop did not match anything at input ','PapyrusTemp\Fragments\Terminals\TERM_aaadWeaponsTerminalSubM_0103F3C7.psc(16,54): required (...)+ loop did not match anything at input ')'No output generated for Fragments:Terminals:TERM_aaadWeaponsTerminalSubM_0103F3C7, compilation failed. What is RPAREN? Now, I can add event to main script selection in creation kit. Won't it fire at start and just close terminal? That is why I was using fragment selection in creation kit. Because I wanted it to fire when the container is activated. Tried making a Blank screen and a simple activate screen. Added this script to main script selection in creation kit.Scriptname aaadPlayerControls extends ScriptObject Function SomeFunction() RegisterForMenuOpenCloseEvent("TerminalMenu") EndFunction Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)if asMenuName == "TerminalMenu" if abOpening == false aaadAmmoContainer.Activate(Game.GetPlayer()) endifendifendEvent ObjectReference Property aaadAmmoContainer Auto However, script doesn't appear to do anything in game. Tho compiles fine. Am I missing a fire script command or something? Edited April 30, 2017 by draco1122 Link to comment Share on other sites More sharing options...
scrivener07 Posted April 30, 2017 Share Posted April 30, 2017 Scriptname aaadPlayerControls extends Quest int YourMenuItemIDThatIDontKnow = 0 const bool DoThing = false Event OnInit() RegisterForRemoteEvent(TheTerminal, "OnMenuItemRun") RegisterForMenuOpenCloseEvent("TerminalMenu") EndEvent ; this is exactly the same as the terminal fragment. Event Terminal.OnMenuItemRun(Terminal akSender, int auiMenuItemID, ObjectReference akTerminalRef) If (auiMenuItemID == YourMenuItemIDThatIDontKnow) ;............................................................................ DoThing = true Debug.MessageBox("Close this terminal to use the container.") ;............................................................................ EndIf EndEvent Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) If (abOpening == false) If (DoThing) aaadAmmoContainer.Activate(Game.GetPlayer()) DoThing = false EndIf EndIf EndEvent Group Properties Terminal Property TheTerminal Auto Const Mandatory ObjectReference Property aaadAmmoContainer Auto Const Mandatory EndGroup Link to comment Share on other sites More sharing options...
draco1122 Posted April 30, 2017 Author Share Posted April 30, 2017 (edited) Scriptname aaadPlayerControls extends Quest int YourMenuItemIDThatIDontKnow = 0 const bool DoThing = false Event OnInit() RegisterForRemoteEvent(TheTerminal, "OnMenuItemRun") RegisterForMenuOpenCloseEvent("TerminalMenu") EndEvent ; this is exactly the same as the terminal fragment. Event Terminal.OnMenuItemRun(Terminal akSender, int auiMenuItemID, ObjectReference akTerminalRef) If (auiMenuItemID == YourMenuItemIDThatIDontKnow) ;............................................................................ DoThing = true Debug.MessageBox("Close this terminal to use the container.") ;............................................................................ EndIf EndEvent Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening) If (abOpening == false) If (DoThing) aaadAmmoContainer.Activate(Game.GetPlayer()) DoThing = false EndIf EndIf EndEvent Group Properties Terminal Property TheTerminal Auto Const Mandatory ObjectReference Property aaadAmmoContainer Auto Const Mandatory EndGroup Thx you for help so far. I placed script under my blank terminal sub menu. Compiles fine and set properties. Just doesn't seem to do anything in game. Just displays menu text no debug text nor does it open container. Now I saw you said something about fragment. Was there something I needed to add to fragment. Also, tried setting int YourMenuItemIDThatIDontKnow = 0 const and this line If (auiMenuItemID == YourMenuItemIDThatIDontKnow) to my menus id of 1. A little confused on how that should read compiled fine tho. Here what I tried (auiMenuItemID == 1). Plus, tried renaming the YourMenuitemIdThatDontKnow to YourMenuItemID. But, that was just guessing really. They all compiled just did nothing in game. I really wanted to thank you for any help. I know I should have got it by now. Also, saw this extends quest tho didn't see any quest items referenced. Did I need to make a quest? Edited April 30, 2017 by draco1122 Link to comment Share on other sites More sharing options...
scrivener07 Posted April 30, 2017 Share Posted April 30, 2017 The script extends QUEST and therefore must be attached to a quest. Link to comment Share on other sites More sharing options...
draco1122 Posted May 1, 2017 Author Share Posted May 1, 2017 (edited) I was afraid you were going to say that. I hate quests lol. Will have to think on it. Edited May 1, 2017 by draco1122 Link to comment Share on other sites More sharing options...
Recommended Posts