Please help me with my messagebox script

Post » Tue May 17, 2011 1:41 pm

Hey, I'm trying to make a messagebox popup to show all skills. There aren't enough variables, though, so I have to do two boxes.

My problem is that when I click "okay" (to return to the game) on menu2, menu1 pops up again, which I don't want -- "okay" works fine to return to the game on message two. For both boxes, button 0 is "Okay" and button 1 is either "MORE" (menu1 to menu2) or "BACK" (menu2 to menu1). I don't want "Okay" on menu2 to go back to menu1. There's a bunch of redundant stuff in here, but that's from playing around trying to figure out what I'm doing wrong.

- Bunch of *cut* variable declarations -Begin GameModeIf IsKeyPressed 184 == 1 || IsKeyPressed 56 == 1	If IsKeyPressed 37 == 1		set skillcheck to 1	EndifEndifIf skillcheck == 1		- bunch of cut variable settings -			set skillcheck to 0		set skillmsg1 to 1EndifIf skillmsg2 == 1	showmessage aaEpicSkillMSG2 skillrepair skillscience skillsneak skillspeech skillsurv skillua	set checkmenu2press to 1	set skillmsg2 to 0	set skillmsg1 to 0endifif checkmenu2press == 1	set menu2pressed to getbuttonpressed	if menu2pressed == 0		set checkmenu2press to 0		set skillcheck to 0		set skillmsg1 to 0		set skillmsg2 to 0	elseif menu1pressed == 1		set skillmsg1 to 1		set checkmenu2press to 0	endifendifIf skillmsg1 == 1	showmessage aaEpicSkillMSG1 skillbarter skillew skillexpl skillguns skilllp skillmed skillmelee	set checkmenu1press to 1	set skillmsg1 to 0	set skillcheck to 0endifIf checkmenu1press == 1	set menu1pressed to getbuttonpressed	if menu1pressed == 0		set checkmenu1press to 0		set skillmsg1 to 0		set skillmsg2 to 0		set skillcheck to 0	elseif menu1pressed == 1		set skillmsg2 to 1		set skillmsg1 to 0		set checkmenu1press to 0	endifendifEnd 


How do I stop that first box (skillmsg1) from popping up when button 0 is pressed on menu2?
User avatar
Kitana Lucas
 
Posts: 3421
Joined: Sat Aug 12, 2006 1:24 pm

Post » Tue May 17, 2011 7:44 am

I would try a timer to block this section for awhile once it's been triggered:

float fTimerif (fTimer <= 0)	If IsKeyPressed 184 == 1 || IsKeyPressed 56 == 1 			If IsKeyPressed 37 == 1 					set skillcheck to 1 					set fTimer to .5			Endif 	Endif else	set fTimer to fTimer - GetSecondsPassedendif

User avatar
Lifee Mccaslin
 
Posts: 3369
Joined: Fri Jun 01, 2007 1:03 am

Post » Tue May 17, 2011 11:24 am

Just a quick note before bed; Add if skillcheck == 0 to the first block, so it only sets it once and will only show the message the one time initially. That way if you press the button for 2 seconds, it doesnt cue up like 20 messages, which is what may be happening.
User avatar
Josh Sabatini
 
Posts: 3445
Joined: Wed Nov 14, 2007 9:47 pm

Post » Tue May 17, 2011 3:19 am

I would try a timer to block this section for awhile once it's been triggered:



Nope, that's not it :(

The skillcheck check didn't work either, though both solutions should have done the same thing.

The weird thing is that the first messagebox pops up instantly (like literally instantly), after pressing "okay" on the second box, whereas the second one takes a quarter-second or so after clicking "more" from the first box -- it's almost like the first messagebox is just sitting behind the second one.
User avatar
Milad Hajipour
 
Posts: 3482
Joined: Tue May 29, 2007 3:01 am

Post » Tue May 17, 2011 3:47 am

I still think it's the IsKeyPressed buffering up, because the rest of it looks like it should work. There's an example on this page that should prevent it: http://cs.elderscrolls.com/constwiki/index.php/IsKeyPressed

if ( curKey && isKeyPressed curkey ) ; key still being held down  return ; wait until it's releasedelse  set curkey to 0endifIf IsKeyPressed 184 == 1 || IsKeyPressed 56 == 1	if ( isKeyPressed 37 )	  set skillcheck to 1	  set curKey to 37	endifendif

User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am


Return to Fallout: New Vegas