Jump to content

OnMenuOpenCloseEvent: Not detecting Pipboy closing first time.


Recommended Posts

I've got a script attached to a quest, which moves the player to another location, and it's shared between a terminal and Pipboy (you can use either the terminal or a holotape to move).  The terminal works absolutely fine, but when it comes to the holotape it's not detecting the exit event.  If you open the Pipboy again it then detects the previous closure event, and when you exit again it also detects that event and does what it needs to.

It's being called with...

Function CheckfortheExit()

Self.RegisterForMenuOpenCloseEvent("TerminalMenu")
Self.RegisterForMenuOpenCloseEvent("PipboyMenu")
Utility.Wait(0.5)

EndFunction

When it detects the exit event it does this...

Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
Debug.Messagebox("Exiting: " + asMenuName)
	If (asMenuName == "TerminalMenu")
		Float ftstage = lfvr_ftstage.GetValue()

			If ftstage == 1
				battlebuttonenabler.Enable()
				slotsbuttonenabler.Enable()
				PlayerRef.MoveTo(lfvr_entrypoint)
			ElseIf ftstage == 2
				(Self As Quest).SetStage(1020)
			ElseIf ftstage == 3
				(Self As Quest).SetStage(1030)
			ElseIf ftstage == 4
				(Self As Quest).SetStage(1010)
			EndIf

		lfvr_ftstage.SetValue(0)
		lfvr_inpip.SetValue(0)

	EndIf

	If (asMenuName == "PipboyMenu")
		Float ftstage = lfvr_ftstage.GetValue()

			If ftstage == 1
				battlebuttonenabler.Enable()
				slotsbuttonenabler.Enable()
				PlayerRef.MoveTo(lfvr_entrypoint)
			ElseIf ftstage == 2
				(Self As Quest).SetStage(1020)
			ElseIf ftstage == 3
				(Self As Quest).SetStage(1030)
			ElseIf ftstage == 4
				(Self As Quest).SetStage(1010)
			EndIf

		lfvr_ftstage.SetValue(0)
		lfvr_inpip.SetValue(0)

	EndIf

Self.UnRegisterForMenuOpenCloseEvent("TerminalMenu")
Self.UnRegisterForMenuOpenCloseEvent("PipboyMenu")

EndEvent

I just can't figure out what's stopping it the first time around.

Any help would be greatly appreciated.

Link to comment
Share on other sites

OnMenuOpenCloseEvent detects both the open and close, to be clear.

Also, about Utility.Wait, that time does NOT pass in menu mode, which would include both pipboy and terminal.

 

I'd say your script is initially getting stuck due to the Wait, continues after the first exit of the pipboy, then functions more or less as you want on subsequent calls by accident.

 

So get rid of the utility.wait line in your function, see how it goes.

Link to comment
Share on other sites

Ah, I thought the terminal did whatever it needed to with the quest and waited for that to complete before moving on.

I'll try your suggestion in a few days.  I've also had it cause a CTD a couple of times so I've replaced it with something else as a stop gap while I work it out.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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