Speeding Up GetbuttonPressed

Post » Wed Feb 02, 2011 3:21 pm

I am having terrible trouble with GetButtonPressed returning the wrong value.

In Oblivion,I could do this:
If ( Part == 1 )  MessageBox" Blah Blah Blah", "Option", "Option", "Option  Set Part to 2ElseIf ( Part == 2 )    Set Button to ( GetButtonPressed)    If ( Button == 1 )......   EndIfEndIf


and I would get the right resposne every time, even if it is run within 1 frame.

In Fallout 3 and Fallout New Vegas, I find I am having to leave at least 2 seconds between pressing a button and having the button checked, otherwise it comes up with the PREVIOUS Button pressed-- so if....

- In Menu A, I Press Button 1, which takes me to Menu B
- In Menu B, I Press Button 3, which takes me to Menu C

I will end up back at Menu B, because GetButtonPressed still returns "1", for some reason, even though I am sure it should return -1, at worst. I know it is not my script, as it works perfectly with the 2-3 seconds delay, but it is rather inconvenient having to wait so long between menus... Is there something that can be done about this?
User avatar
Cody Banks
 
Posts: 3393
Joined: Thu Nov 22, 2007 9:30 am

Post » Wed Feb 02, 2011 11:55 am

Ive not heard of this problem before, are you running this script in a GameMode block? If its in a GM block then the script will not run once the menu has opened (as the game moves to MenuMode) which means that once the menu is closed (by pressing a button) the GetButtonPressed function should return the correct number without running the script with the previous value as it has been waiting for the menu to close before running again. If that makes any sense!
User avatar
pinar
 
Posts: 3453
Joined: Thu Apr 19, 2007 1:35 pm

Post » Wed Feb 02, 2011 11:19 pm

It's being run in MenuMode 1002, which is the Inventory. When the Menu opens, it drops out of 1002, which stops it running again during the Menu-- in Oblivion, though, it worked perfectly when you drop back into 1002...

I've not been able to find any reference to this myself :( I'm reasonably certain it's not my PC-- I can play NV on maximum setting without an issue, and the script is not particularly long, so it shouldn't be taking up an unusual amount of power...

I know 2-3 seconds doesn't sound like much, but when you're waiting... :S
User avatar
My blood
 
Posts: 3455
Joined: Fri Jun 16, 2006 8:09 am

Post » Wed Feb 02, 2011 11:29 am

Maybe its because the "Set part to 2" bit is after the messagebox command? Try putting the messagebox bit at the end of each if statement (or as late as possible) to ensure that all the variables update before the menu is shown. The messagebox probably stops the script running just before the 'part' variable is changed, so when the script runs again after a button is clicked, its checking the button value in the wrong part of the script.

May not work but its only a small change so try it and let me know what happens.

EDIT - accidentally wrote before not after at the beginning there.
User avatar
Sudah mati ini Keparat
 
Posts: 3605
Joined: Mon Jul 23, 2007 6:14 pm

Post » Wed Feb 02, 2011 1:26 pm

I had to do this sort of thing to do a menu-within-a-menu, which I think you are trying to do:

BEGIN MenuMode 1075		;wheel selections. 			if (MenuMode 1001)			else				ShowMessage RHKWendyWheelPSVAggroMSG							;etc							endif			END	

User avatar
Madeleine Rose Walsh
 
Posts: 3425
Joined: Wed Oct 04, 2006 2:07 am


Return to Fallout: New Vegas