Jump to content

Message Box Woes


DaylenTheMaleficar

Recommended Posts

I'm have a couple of issues getting some message boxes to work. The first issue is with getting a GlobalVariable to display in the box. I've put the <Global=MyGlobal> into the message field, added them to the list on the Quest Data tab, and put UpdateCurrentInstanceGlobal() for the globals at the start of the script, yet the message box always displays [...] where the numbers should be.

 

My second problem is that each message box pops up at least once immediately after I make a selection, which really screws me over given that the selections make permanent changes to the script and stack. Here's the gist of my menu script:

Function SpendPoints(int aiButton = 0, int abMenu = 0)
	 While abMenu == 0
		 if aiButton != -1
			 aiButton = LevelUp.show()
			 if (aiButton == 0 && Endurance.GetValueInt() < 100)
				 Endurance.mod(1 + ssEndInc.GetValueInt())
				 ssEndInc.SetValue(0)
				 ssEndIncUsed.SetValue(1)
				 abMenu = 1
			 elseif (aiButton == 1 && Agility.GetValueInt() < 100)
				 Agility.mod(1 + ssAgiInc.GetValueInt())
				 ssAgiInc.SetValue(0)
				 ssAgiIncUsed.SetValue(1)
				 abMenu = 1
;			          .
;                                 .
;			          . And so on...
;                                 .
			 elseif (aiButton == 6 && Willpower.GetValueInt() < 100)
				 Willpower.mod(1 + ssWilInc.GetValueInt())
				 ssWilInc.SetValue(0)
				 ssWilIncUsed.SetValue(1)
				 abMenu = 1
			 endif
		 endif
	 endWhile
	 While abMenu == 1
		 if aiButton != -1
			 aiButton = LevelUp2.show()
			 if (aiButton == 0 && Endurance.GetValueInt() < 100)
				 Endurance.mod(1 + ssEndInc.GetValueInt())
				 ssEndInc.SetValue(0)
				 ssEndIncUsed.SetValue(1)
				 abMenu = 2
;			          .
;                                 .
;			          . And so on...
;                                 .
			 elseif (aiButton == 6 && Willpower.GetValueInt() < 100)
				 Willpower.mod(1 + ssWilInc.GetValueInt())
				 ssWilInc.SetValue(0)
				 ssWilIncUsed.SetValue(1)
				 abMenu = 2
			 endif
		 endif
	 endWhile
endFunction

What causes these menus to pop up twice, and how do I stop it? (They're triggered when the Level Up menu opens, if that helps)

Link to comment
Share on other sites

Okay, for testing purposes, I've simplified the code a great deal, yet the message continues to display multiple times even though I've set up a While that should end as soon as an input is returned. Can anyone tell what I'm doing wrong?

Event OnInit()
	 RegisterForMenu("LevelUp Menu")
	 UpdateCurrentInstanceGlobal(ssEndInc)
	 UpdateCurrentInstanceGlobal(ssWilInc)
EndEvent

Event OnMenuOpen(String MenuName)
	 if MenuName == "LevelUp Menu"
		 HasLeveled = True
	 endif
endEvent

Event OnMenuClose(String MenuName)
	 if MenuName == "LevelUp Menu"
		 While HasLeveled == True
			 Utility.Wait(1)
			 Menu()
			 Utility.Wait(1)
			 CalcStats()
			 HasLeveled = False
		 endWhile
	 endif
endEvent



Function Menu(Bool abMenu = True, Int aiButton = 0)
	 While abMenu
		 If aiButton != -1 
			 aiButton = LevelUp.show()
			 abMenu = False ; End the function
			 if aiButton == 0
				 Endurance.mod(1 + ssEndInc.GetValueInt())
				 ssEndInc.SetValue(0)
				 ssEndIncUsed.SetValue(1)
			 elseif aiButton == 1
				 Agility.mod(1 + ssAgiInc.GetValueInt())
				 ssAgiInc.SetValue(0)
				 ssAgiIncUsed.SetValue(1)
			 elseif aiButton == 2
				 Strength.mod(1 + ssStrInc.GetValueInt())
				 ssStrInc.SetValue(0)
				 ssStrIncUsed.SetValue(1)
			 elseif aiButton == 3
				 Speed.mod(1 + ssSpeInc.GetValueInt())
				 ssSpeInc.SetValue(0)
				 ssSpeIncUsed.SetValue(1)
			 elseif aiButton == 4
				 Intelligence.mod(1 + ssIntInc.GetValueInt())
				 ssIntInc.SetValue(0)
				 ssIntIncUsed.SetValue(1)
			 elseif aiButton == 5
				 Personality.mod(1 + ssPerInc.GetValueInt())
				 ssPerInc.SetValue(0)
				 ssPerIncUsed.SetValue(1)
			 elseif aiButton == 6
				 Willpower.mod(1 + ssWilInc.GetValueInt())
				 ssWilInc.SetValue(0)
				 ssWilIncUsed.SetValue(1)
			 endif
		 EndIf
	 EndWhile
	 Debug.Notification("While Ended")
EndFunction


Link to comment
Share on other sites

Did you just get rid of that useless "while" loop?

 

Oblivion scripting required a loop for message boxes to display properly, but Skyrim doesn't. That's why I guessed you had been scripting for Oblivion.

 

As for the issue with the global, are you testing on a new game or a save game?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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