PDA

View Full Version : Shift buttons


Twilight
13-02-2004, 04:14 PM
I've been reading a bit on programming my HOTAS. I've seen that most (if not all) buttons can be assigned as "shift" buttons. My question is, can we have several _DIFFERENT_ shift buttons at the same time? And if so, how do I know which one is going to be referenced?

That is, if I have two different shift buttons, can I program something like:

if Shifted1 then do...
else
if Shifted2 then do...


I hope I was clear enough


Thanx :thumbsup:


Twilight

MichaelCHProd
13-02-2004, 05:37 PM
Sorry but if you are staying in the GUI then no. That's what the modes are for. :D

Now if you wanted to do some scripting you could but it would mean ALOT of IF THEN statements

Twilight
13-02-2004, 10:56 PM
Thanks for the reply!!

I'm not afraid of doing some scripting, if it's worth it (I've done some in the past). But if you think its not really worth it, then I guess I should use the modes instead.
:thumbsup:

Twilight

MichaelCHProd
14-02-2004, 01:02 AM
Go for it. You don't have to use the hard wired mode control button if you don't want. You can always script a new mode control, you get a fourth mode that way. :D It's easy.....

If you want one button to jump through the modes.

SCRIPT

Â* SEQUENCE
Â* Â* WAIT( JS1.B2 );Â* Â* Â* Â* Â* // Wait here until JS1.B2 clicks
Â* Â* A1 = A1 + 1;Â* Â* Â* Â* Â* Â* // Add 1 to our Mode counter
Â* Â* IF( [ A1 > 3 ] ) THENÂ* Â* // If the value is over 3 then
Â* Â* Â* A1 = 0;Â* Â* Â* Â* Â* Â* Â* Â* //Â* Â* set it back to 0
Â* Â* ENDIF
Â* Â* CURRENTMODE = A1;Â* Â* Â* Â* // Now copy it to CURRENTMODE
Â* ENDSEQUENCE

ENDSCRIPT
[/b]

If you want a HAT to give yo four directions and each direction is a different mode so you can jump from Mode 1 to mode 4 without going through 2 and 3.

SCRIPT

Â* IF( JS1.B13 ) THEN
Â* Â* CURRENTMODE = MODE1;
Â* ELSE
Â* Â* IF( JS1.B14 ) THEN
Â* Â* Â* CURRENTMODE = MODE2;
Â* Â* ELSE
Â* Â* Â* IF( JS1.B15 ) THEN
Â* Â* Â* Â* CURRENTMODE = MODE3;
Â* Â* Â* ELSE
Â* Â* Â* Â* IF( JS1.B16 ) THEN
Â* Â* Â* Â* Â* CURRENTMODE = MODE4;
Â* Â* Â* Â* ENDIF
Â* Â* Â* ENDIF
Â* Â* ENDIF
Â* ENDIF

ENDSCRIPT
[/b]

Just remember to setup the right button(s) and JS for your map. It is alos best if you do not have anything assigned to those buttons other than Mode control( so make sure they are NONE and NONE in the GUI).

MichaelCHProd
14-02-2004, 01:02 AM
I might move this to the Scripting Forum after a bit.

Twilight
14-02-2004, 05:59 AM
Right! And if I got you right, I could program 3 or 4 buttons to set a different mode each Then I would acomplish basically the same effect as having several different shift buttons, right?

(evil grin!)

Thanks for the help!


Twilight

MichaelCHProd
14-02-2004, 09:18 AM
Pretty much. ;)

JNOV
15-02-2004, 05:33 PM
Twilight:

I don't like just having one shift button either! For complex maps, what I normally do is ignore the "shift button" box in the GUI (I usually pretty much ignore the GUI altogether, except for the CMS tab) and assign shift buttons and "modes" in my script.

My typical scheme involves four shift states: unshifted, shift 1, shift 2, and shift 3. These states correspond to the four possible states of two separate shift buttons (i.e., to generate the "shift 1" state, I press the shift 1 button, to generate the "shift 2" state, I press the shift 2 button, and to generate the "shift 3" state, I press both of them together). For the two shift buttons, I normally choose the pinkie and outside forefinger key on the Fighterstick and the pinkie and ring finger key on the Pro Throttle. I use duplicate shift keys (i.e., there are "shift 1" and "shift 2" keys on both the stick and throttle) for ease of use (I find it easier to use the shift keys on the hand opposite that pressing the button or hat swtich to be shifted), but you don't need to do so.

I normally define labels like "NoShift", "Shift1", "Shift2", and "Shift3" to be the logical combination of shift keys necessary to generate the states, so that I can just use the label throughout the reset of the script. The following definitions, for example,

%define Shift1 (js1.b4 or js2.b4) and not (js1.b3 or js2.b3)
%define Shift2 not (js1.b4 or js2.b4) and (js1.b3 or js2.b3)
%define Shift3 (js1.b4 or js2.b4) and (js1.b3 or js2.b3)
%define NoShift not (js1.b4 or js2.b4) and not (js1.b3 or js2.b3)

provide easy access to shift states generated by the two sets of shift keys I described above.

Another option, which I sometimes use in combination with shift states is to define "modes," which are essentially persistent shift states. In other words, once you select a mode, it stays selected until you select another. Deciding how to combine modes and shift states is a matter of preference but I usually use modes where it is convenient for the selection to persist without me holding down shift keys (e.g., in WWII sims, I usually assign weapon modes to determine whether the trigger fires guns, guns and cannons, or cannons alone).

You can see an example of how I use shift states by looking at the JPEG of my LOMAC template that I attached to another thread in this forum (that Revvin started and you replied in, if I recall correctly).

If you look at it, notice that I assign actual functions to the four shift buttons. Those functions are in purple text within triangular brackets beneath the four shift keys. I use "time-parsing" to generate those functions. That is, the shift keys are always shift keys, but if they are pressed and released sufficiently quickly (e.g., within .2 seconds), they generate the "time-parsed" function. This is kind of nice, because your shift keys become dual-purpose. In the LOMAC map, I've used time parsing to generate TrackIR commands, but I often use it for things like toggling zoom or stepping forward and backward through a sequence of modes.

I hope this is useful.

- JNOV

Fever
16-02-2004, 03:59 PM
Can someone post an example of an efficent time sparsing script? I would like to use it to activate wingman commands when im in single player, dont need the multiplayer coms then but could use the same buttons.

Time sparsing in combination with the menu stepping script i saw in another thread would be cool :).

Fever

Twilight
16-02-2004, 08:02 PM
Thanx JNOV!!

Tha's exactly what I was looking for in the first place!!! I'd seen shift1 shift2 shift3 in someone else's profile, but didn't understand how that would work. Now it is all clear! It's just plain scripting. Cool!

I think this weekend I'll begin earning my B.Sc. in Control manager scripting! It sounds quite exciting (A lame excuse to return to my programming roots!!) :D


Twilight

Fever
16-02-2004, 08:25 PM
Didn't mean to hi-jack thread... will move question to main CMS scripting area. I meant parsing by the way.. not sparsing :).

Fev

JNOV
16-02-2004, 11:49 PM
Twilight: Glad that was helpful!

Fever: I replied to your post in the scripting forum with a time-parsing example from one of my scripts.

- JNOV