PDA

View Full Version : Pro Throttle Z-axis



polymemnon
2nd February 2010, 05:29 PM
I'm trying to set up A3 on my Pro Throttle (the Z-axis) to work with Star Trek Online. In the game, the throttle is increased by sending 'e', and decreased by sending 'q'. There are 4 throttle settings, so four 'e's will max your thrust, and four 'q's will bring you back to zero thrust.

I tried using the GUI up/down setting for A3, but it's too imprecise. If the A3 control is not moved very slowly, some 'e's and 'q's are missed. So, for example, I increase the throttle (A3) to max, but only two 'e's are sent. Then I pull the throttle (A3) all the way back, and two q's may be sent, or more or less. So now I have A3 pulled all the way back, but am still at half or quarter thrust in game, or have gone into reverse.

So I tried using a CMS script. There is another way to set the in-game throttle, using the /ThrottleSet command. For example, "/ThrottleSet 0.25" will set the throttle at half power. Using this command, this was my first effort at a script:

SELECT ( JS1.A3, POSITION ) OF
CASE 255:
CMS.B28 = TRUE; // sends "/ThrottleSet 0"
EXITCASE:
CMS.B28 = FALSE;
BREAK;
CASE 238:
CMS.B29 = TRUE; // sends "/ThrottleSet 0.25"
CMS.B128 = TRUE;
CMS.B29 = FALSE;
BREAK;
CASE 188:
CMS.B30 = TRUE; // sends "/ThrottleSet 0.5"
EXITCASE:
CMS.B30 = FALSE;
BREAK;
CASE 124:
CMS.B31 = TRUE; // sends "/ThrottleSet 0.75"
EXITCASE:
CMS.B128 = FALSE;
BREAK;
CASE 60:
CMS.B32 = TRUE; // sends "/ThrottleSet 1.0"
EXITCASE:
CMS.B32 = FALSE;
BREAK;
ENDSELECT

This didn't work. On downloading the script, I got and endless transmission of keystrokes, because A3 was at 255, making CMS.B28 true. Only moving the throttle would make CMS.B28 false, but that would make another CMS button stuck on true, etc.

Removing the EXITCASE: lines doesn't work, because, without a delay between setting a CMS control true and then false, neither state change is recognized. I tried sending a NULL character between the state changes, but that didn't help.

Next I tried this:
SEQUENCE
WAIT( ( [ JS1.A3 <= 255 ] ) AND ( [ JS1.A3 > 238 ] ) );
CMS.B28 = TRUE;
DELAY( 1 );
CMS.B28 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 238 ] ) AND ( [ JS1.A3 > 188 ] ) );
CMS.B29 = TRUE;
DELAY( 1 );
CMS.B29 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 188 ] ) AND ( [ JS1.A3 > 124 ] ) );
CMS.B30 = TRUE;
DELAY( 1 );
CMS.B30 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 124 ] ) AND ( [ JS1.A3 > 60 ] ) );
CMS.B31 = TRUE;
DELAY( 1 );
CMS.B31 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 60 ] ) AND ( [ JS1.A3 > 0 ] ) );
CMS.B32 = TRUE;
DELAY( 1 );
CMS.B32 = FALSE;
ENDSEQUENCE

Using sequences and DELAYs, the state changes were recognized and not repeated endlessly.However, again A3 had to be moved slowly, or only a single sequence would actually be processed. So pushing A3 to maximum would provide in-game thrust of only 25%, and pulling A3 all the way back would increase the in-game thrust to 75%.

The SELECT block allowed for faster A3 movement, though it required that A3 keep moving to avoid infinite character transmissions. If I could put WAIT and DELAY statements in the SELECT block, that would seem to solve all the problems. Of course, that's not allowed, so I tried this:

SELECT ( JS1.A3, POSITION ) OF
CASE 255:
B28 = TRUE;
BREAK;
CASE 238:
B29 = TRUE;
BREAK;
CASE 188:
B30 = TRUE;
BREAK;
CASE 124:
B31 = TRUE;
BREAK;
CASE 60:
B32 = TRUE;
BREAK;
ENDSELECT

SEQUENCE
WAIT( B28 );
B28 = FALSE;
DELAY( 1 );
CMS.B28 = TRUE;
DELAY( 1 );
CMS.B28 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( B29 );
B29 = FALSE;
DELAY( 1 );
CMS.B29 = TRUE;
DELAY( 1 );
CMS.B29 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( B30 );
B30 = FALSE;
DELAY( 1 );
CMS.B30 = TRUE;
DELAY( 1 );
CMS.B30 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( B31 );
B31 = FALSE;
DELAY( 1 );
CMS.B31 = TRUE;
DELAY( 1 );
CMS.B31 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( B32 );
B32 = FALSE;
DELAY( 1 );
CMS.B32 = TRUE;
DELAY( 1 );
CMS.B32 = FALSE;
ENDSEQUENCE

This fixed the infinite transmissions, but, again, A3 had to be moved painfully slowly or the transmissions would be missed.

How can I make this work?

polymemnon
2nd February 2010, 06:14 PM
After trying various other variations on SELECT blocks, IF/THEN blocks, and sequences, this is as close to desired funtionality as i can get:

SEQUENCE
WAIT( ( [ JS1.A3 <= 238 ] ) AND ( [ JS1.A3 > 188 ] ) );
CMS.B29 = TRUE; // sends "/ThrottleSet 0.25"
DELAY( 10 );
CMS.B29 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 188 ] ) AND ( [ JS1.A3 > 124 ] ) );
CMS.B30 = TRUE; // sends "/ThrottleSet 0.50"
DELAY( 10 );
CMS.B30 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 124 ] ) AND ( [ JS1.A3 > 60 ] ) );
CMS.B31 = TRUE; // sends "/ThrottleSet 0.75"
DELAY( 10 );
CMS.B31 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 60 ] ) AND ( [ JS1.A3 > 0 ] ) );
CMS.B32 = TRUE; // sends "/ThrottleSet 1.0"
DELAY( 10 );
CMS.B32 = FALSE;
ENDSEQUENCE

SEQUENCE
WAIT( ( [ JS1.A3 <= 255 ] ) AND ( [ JS1.A3 > 238 ] ) );
CMS.B28 = TRUE; // sends "/ThrottleSet 0"
CMS.B28 = FALSE;
ENDSEQUENCE

When pushing A3 forward, as rapidly as I'd like, everything works perfectly. However, when pulling A3 back too rapidly, the thrust setting changes in this order: 75%, 0%, 25%, 50%. You can see in the script above that I actually placed the sequence that sets the thrust at 0 last to try to alleviate this problem, but it had no effect. I'm running out of ideas, please help.