How can I get around the Messagebox bug?

Post » Fri Nov 18, 2011 2:51 am

Has there been a solution to the Message Box bug? For those that don't know, if you execute a Messagebox and then a menu pops up, the Messagebox doesn't clear. Nor can you click on the "OK" button on the Messagebox.

I thought about adding a timer so that the player can have a few seconds to read the message and close it before the menu pops up, but I haven't had much luck with it. Using Thomas Kaira's example, here is what I have.

Scn ChestScriptbegin onActivate     if STQuest001.bypass == 0 && GetStage STQuest001 < 10 && player.GetAV Security >= 30 && STQuest001.ChestActivate == 0 ;HIGH SECURITY NO KEY         Messagebox "I bypassed the trap."         set STQuest001.ChestActivate to 1         set STQuest001.timer to 1    endifendbegin gameMode	if STQuest001.timer > 0		set STQuest001.timer to STQuest001.timer - getsecondspassed			elseif STQuest001.ChestActivate == 1 && timer <= 0				stSeranChest.Lock 30				stSeranChest.Activate	endifend


What is odd is if I set it to "set STQuest001.timer to 1", I click on the chest and get the message. The timer goes to 0.0150 but stops counting down. I set it to five and it started counting down but stop at 0.80. For some reason the timer wont go to zero. Thanks for any help.
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Fri Nov 18, 2011 3:00 pm

I have honestly never run into that bug. One thing you might try is to manually specify the buttons. Or you could try using just a regular message popup with a time set to display, so the player doesn't have to click anything.

One other thing, I notice you have your timer variable being tracked on a quest script. This is a bad idea in general, because quest scripts are not executed every frame. By default, they only run every 5sec, unless you declare float fQuestDelayTime at the beginning and then in the GameMode block set fQuestDelayTime to 0.01. and even still, this command to have it run every .01sec instead still won't always run every frame, so scripts which move objects or involve timers are best kept out of quest scripts.

I'd just keep your timer variable in the chest script and do something like this:

Scn ChestScriptref timerbegin onActivate     if STQuest001.bypass == 0 && GetStage STQuest001 < 10 && player.GetAV Security >= 30 && STQuest001.ChestActivate == 0 ;HIGH SECURITY NO KEY         Message "I bypassed the trap.", 3         set STQuest001.ChestActivate to 1         set timer to 1    endifendbegin gameMode	if STQuest001.ChestActivate == 1		if timer > 0			set timer to timer - getsecondspassed		elseif timer <= 0			stSeranChest.Lock 30			stSeranChest.Activate			set STQuest001.ChestActivate to 0		endif	endifend

User avatar
Marquis deVille
 
Posts: 3409
Joined: Thu Jul 26, 2007 8:24 am

Post » Fri Nov 18, 2011 3:01 am

I have honestly never run into that bug. One thing you might try is to manually specify the buttons. Or you could try using just a regular message popup with a time set to display, so the player doesn't have to click anything.

One other thing, I notice you have your timer variable being tracked on a quest script. This is a bad idea in general, because quest scripts are not executed every frame. By default, they only run every 5sec, unless you declare float fQuestDelayTime at the beginning and then in the GameMode block set fQuestDelayTime to 0.01. and even still, this command to have it run every .01sec instead still won't always run every frame, so scripts which move objects or involve timers are best kept out of quest scripts.

I'd just keep your timer variable in the chest script and do something like this:

Scn ChestScriptref timerbegin onActivate     if STQuest001.bypass == 0 && GetStage STQuest001 < 10 && player.GetAV Security >= 30 && STQuest001.ChestActivate == 0 ;HIGH SECURITY NO KEY         Message "I bypassed the trap.", 3         set STQuest001.ChestActivate to 1         set timer to 1    endifendbegin gameMode	if STQuest001.ChestActivate == 1		if timer > 0			set timer to timer - getsecondspassed		elseif timer <= 0			stSeranChest.Lock 30			stSeranChest.Activate			set STQuest001.ChestActivate to 0		endif	endifend



Thanks for the information. I'll have to try this once I get home. Having the ability to set the message's display time will help a lot. As for the bug, the wiki mentions is but doesn't offer any kind of work around. Hopefully this will be it.
User avatar
Darlene Delk
 
Posts: 3413
Joined: Mon Aug 27, 2007 3:48 am

Post » Fri Nov 18, 2011 9:07 am

Oh man, this very nearly works. The message box displays, I hit okay and then the lockpicking mini-game comes up. I play through it and then, woops!, it all starts back over. I basically get caught in a loop. I tried adding a new condition that would check to see if you've already gone through the lockpicking part but it doesn't seem to stick. Here is what I have so far:

Scn STSeranChestScriptshort bypassref timershort ChestUnlockshort ChestActivateBegin onActivate	if STQuest001.bypass == 0 && player.GetAV Security < 30  ;LOW SECURITY NO KEY		Messagebox "That's not good..."		Cast StandardFireDamageArea3Journeyman Player			; Don't Touch This			elseif STQuest001.bypass == 1 && GetStage STQuest001 > 40 ;HAS KEY AND QUEST				stSeranChest.Unlock 1				Activate				player.RemoveItem STSeranKey 1				setStage STQuest001 100			; End Don't Touch This					elseif STQuest001.bypass == 1 && GetStage STQuest001 < 40 ;HAS KEY NO QUEST						stSeranChest.Unlock 1						Activate							elseif STQuest001.bypass == 0 && GetStage STQuest001 < 10 && player.GetAV Security >= 30 && ChestActivate == 0 && ChestUnlock == 0 ;HIGH SECURITY NO KEY								Messagebox "Seems Seran has magically trapped the chest. What, doesn't he trust me?", Okay								set ChestActivate to 1								set timer to 1							endif									endifEndbegin gameMode        if ChestActivate == 1                if timer == 1                        set timer to timer - getsecondspassed                elseif timer <= 0 && ChestUnlock == 0                        	stSeranChest.Lock 30                        	stSeranChest.Activate				set ChestUnlock to 1				set timer to 2					elseif timer == 2 && ChestUnlock == 1							stSeranChest.Unlock 1							stSeranChest.Activate                endif        endifend


Thank you Phinix for the help on that first bit. Hopefully I'm just overlooking something silly to get it to move on.
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Fri Nov 18, 2011 4:37 am

Got it! Not sure how really. Going to have to look at the two and see what the differences are. I was right about adding an additional condition. Here is the working script:

Scn STSeranChestScriptshort bypassref timershort ChestUnlockshort ChestActivateBegin onActivate	if STQuest001.bypass == 0 && player.GetAV Security < 30  ;LOW SECURITY NO KEY		Messagebox "That's not good..."		Cast StandardFireDamageArea3Journeyman Player			; Don't Touch This			elseif STQuest001.bypass == 1 && GetStage STQuest001 > 40 ;HAS KEY AND QUEST				stSeranChest.Unlock 1				Activate				player.RemoveItem STSeranKey 1				setStage STQuest001 100			; End Don't Touch This					elseif STQuest001.bypass == 1 && GetStage STQuest001 < 40 ;HAS KEY NO QUEST						stSeranChest.Unlock 1						Activate							elseif STQuest001.bypass == 0 && GetStage STQuest001 < 10 && player.GetAV Security >= 30 && ChestActivate == 0 && ChestUnlock == 0 ;HIGH SECURITY NO KEY								Messagebox "Seems Seran has magically trapped the chest. What, doesn't he trust me?", Okay								set ChestActivate to 1								set timer to 1								set ChestUnlock to 0							endif										elseif ChestUnlock == 1									stSeranChest.Unlock 1									Activate							endifEndbegin gameMode        if ChestActivate == 1                if timer > 0                        set timer to timer - getsecondspassed                elseif timer <= 0 && ChestUnlock == 0                        	stSeranChest.Lock 30                        	stSeranChest.Activate					set ChestUnlock to 1                endif        endifend


I was getting worried I wouldn't be able to have my trapped chest for the Quest. But this works just like I was hoping. Thank you Phinix. Without you this wouldn't have made it in.
User avatar
Chloe Yarnall
 
Posts: 3461
Joined: Sun Oct 08, 2006 3:26 am


Return to IV - Oblivion