Jump to content

Script Help getting a terminal to Close


Recommended Posts

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

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

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 by draco1122
Link to comment
Share on other sites

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

 

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())
endif
endif
It 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 RPAREN
PapyrusTemp\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())
endif
endif
endEvent
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 by draco1122
Link to comment
Share on other sites


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

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 by draco1122
Link to comment
Share on other sites

I was afraid you were going to say that. I hate quests lol. Will have to think on it.

Edited by draco1122
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...