PDA

View Full Version : Sequence Programming Problem


LukeFF
17-06-2005, 10:45 PM
Hello,

I am trying to program a simple two-button sequence in Pacific Fighters which toggles between the Zoom In and and Zoom Out views. I have the sequence working in-game, but when I exit to Desktop the Joystick (Fighterstick USB) is not releasing the last command I sent via the sequence. My script looks like this:

SCRIPT

SEQUENCE
WAIT( JS1.B7 ); // Wait until Button 2 is pressed
A1 = A1 + 1; // Increment our message counter
IF( [ A1 > 1 ] ) THEN // If A1 is over three then
A1 = 0; // Reset A1 to 0
ENDIF
ENDSEQUENCE

SELECT( A1, POSITION ) OF

CASE 0:
CMS.B1 = TRUE; // Set the bit for our first message
EXITCASE:
CMS.B1 = FALSE; // Clear the bit for our first message
BREAK;

CASE 1:
CMS.B2 = TRUE; // Set the bit for our second message
EXITCASE:
CMS.B2 = FALSE; // Clear the bit for our first message
BREAK;

ENDSELECT

ENDSCRIPT

The key commands are the KBDEL (B2) and KBEND (B1). Any help with this would be much appreciated. Thanks!

abe_beson
17-06-2005, 11:17 PM
Hi Luke!

The problem is that you keep holding the zoom in or zoom out button until you press your joystick button the next time. And that means there is always a button held all the time once you press you joystick button.

My solution is a little bit slower than your, but it should work fine anyway. So I would do it like this instead:

sequence
wait(js1.b7);
CMS.B2 = TRUE;
delay(2);
CMS.B2 = FALSE;
delay(2);
wait(js1.b7);
CMS.B1 = TRUE;
delay(2);
CMS.B1 = FALSE;
delay(2);
endSequence


/Abe

LukeFF
17-06-2005, 11:53 PM
Thanks, Abe! That did the trick. :)

abe_beson
18-06-2005, 01:19 PM
Great! :cheers: