PDA

View Full Version : another simple question:



Crow
10th March 2009, 07:33 PM
I don't know the answer to this, which is why I ask:

I setup this:
CMS.B6 OUTPUTS KEYBOARD i (NULL i)
CMS.B7 OUTPUTS KEYBOARD j (NULL j)

( The 3 scripts below have exactly identical lines except some of the lines are commented out of the script)

CMS.A4 = JS1.A1;
CMS.B6 = [CMS.A4<100];
CMS.B7 = [CMS.A4<100];
// CMS.B6 = [CMS.A4>200];
// CMS.B7 = [CMS.A4>200];

will output i and j when moving FS stick left
and will do nothing when moving it right
===================================

CMS.A4 = JS4.A1;
// CMS.B6 = [CMS.A4<100];
// CMS.B7 = [CMS.A4<100];
CMS.B6 = [CMS.A4>200];
CMS.B7 = [CMS.A4>200];

will do nothing when moving it left
and will output i and j when moving it right
====================================
CMS.A4 = JS4.A1;
CMS.B6 = [CMS.A4<100];
CMS.B7 = [CMS.A4<100];
CMS.B6 = [CMS.A4>200];
CMS.B7 = [CMS.A4>200];

will do nothing when moving stick left
and will output i and j when moving stick right

How come it won't output i & j moving stick either left and right?

Bob Church
10th March 2009, 08:52 PM
Hi Crow,

It's because the second set of comparisons is setting the same set of variables as the first set. The second set will always win, and ">200" is stick right. The first comparisons do work, but the second set overwrites the result.

Try putting the comparisons together:


script
cms.b6 = [ cms.a4 < 100 ] || [ cms.a4 > 200 ];
cms.b7 = [ cms.a4 < 100 ] || [ cms.a4 > 200 ];
endScript

It never writes cms.b6 or cms.b7 twice so you shouldn't see a conflict. You could save a little time (not that it matters much) by changing the last line to "cms.b7 = cms.b6". It would save having to do the comparison and OR operation twice.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

Crow
10th March 2009, 11:05 PM
Yes, thanks that works perfectly!

I managed just now to write the script (which works fine) using TQ levers, instead of the stick, so that the lever positions (up or down) will indicate what the toggled states are.

Handy when the HUD does not display the state of several cockpit toggle switches, especially when they use the same keypress for ON and OFF.

The TQ lever positions become the HUD, so to speak!

Bob Church
11th March 2009, 03:36 AM
Hi Crow,

Sounds good! I don't know if they'd be any use, but the detent buttons and the behind-the-detent buttons (Buttons 13..24) are operational, you might be able to use one of those directly, too.

Anyway, I'm glad you got it running!

Best regards,

- Bob

The StickWorks
http://www.stickworks.com