Jump to content
The simFlight Network Forums
Sign in to follow this  
KingPenguinUK

Button Holding Toggle?

Recommended Posts

Is it possible to set up my joystick using FSUIPC so that when I hold a certain joystick button it toggles other buttons to something else?

My current joystick is X52Pro and I have the switches below my joystick control currently set to Gear up/down and flaps up/down.

What I want to know if I hold one of the buttons on say my throttle and then go to use the switches they do something different? ie control the light on my aircraft.

Any help would be appreciated, thank you :)

P.S I did a quick search for this but couldn't find anything relevant, though my searching skills are like my flying skills, not very good :p

Share this post


Link to post
Share on other sites

You might want to read the "FSUIPC4 for Advanced Users" PDF file as that will explain

a lot of the features which will allow you to expand the capabilities of your joystick

switches and buttons.

A couple of sections are of particular interest to anyone wishing to have multiple functions from

a single switch or button.

"Adding Offset Conditions" starting at the bottom of Page 18

"Appendix" on Page 42

Also refer to "List of FSX controls.pdf"

I have a Saitek Pro Yoke with dual throttle quadrants and have set up the

6 double throw switches (12 switches functionally ) to provide me with

70 discrete actions in one particular aircraft specific situation.

I used two of the switches to increment and decrement a value in the user-defined

offset "66C0". The value contained in offset "66C0" determines what function any

of the other 10 switches perform. Think of it as defining a number of "control sets",

similar to the "Mode switch" on some sticks or the "pinky switch" to give a "shifted function".

Here is an excerpt from my FSUIPC.ini file that defines the functions to be performed

by the same two switches on one of my throttle quadrants.

The switches are identified as #14 and #15 on joystick 3.

The first number is merely a line number.

The "B66C0=0" part indicates that the following code is executed only when location "66C0" contains

a value of "0".

"P3,14" indicates a button PRESSED on joy 3, button 14.

The remainder of the line indicates the function to be executed.

The first entry here says to send a value of "0" to the variable "19" in the MACRO file number 4.

0=B66C0=0 P3,14,CM4:19,0 ;//APU Start, on PRESS of button 14

1=B66C0=0 U3,14,CM4:19,2 ;//APU GEN ON, on release of button 14

2=B66C0=0 P3,15,CM4:19,1 ;//APU OFF on PRESS of button 15

.

.

20=B66C0=1 P3,14,C66363,0 ;//GEN 1 Here a press of button 14 sends a "0" to offset 66363, Toggle GEN 1

21=B66C0=1 P3,15,C66364,0 ;//GEN 2 Here a press of button 15 sends a "0" to offset 66364, Toggle GEN 2

.

.

30=B66C0=2 P3,14,C65580,0 ;//AUTOPILOT MASTER Here button 14 toggles thw AP Master switch

31=B66C0=2 P3,15,C65726,0 ;//ALTITUDE HOLD Here button 15 toggles the ALT HOLD function

.

.

50=B66C0=3 P3,14,CM4:21,0 ;//RADAR ALTIMETER 1 ON/OFF Here again a MACRO file is referenced, entry 21 receives a "0"

51=B66C0=3 P3,15,CM4:22,0 ;//RADAR ALTIMETER 1 RANGE SWITCH The same MACRO file, entry 22 receives a "0"

Note that the value contained in "66C0" is what determines how a given switch functions. You can have as many different functions

as you wish by simply dedicating one switch/button to change the value in "66C0".

So after all this, the answer to your question is "yes". There is a method to test the condition of one button in order to

change the function of another. mThat is in the section "COMPOUND BUTTON CONDITIONS" on page 16 of the

Advanced Users files.

I merely demonstrated a means to carry this to extreme with another method :)

Paul

Share this post


Link to post
Share on other sites

So I'm guessing for what I want I need to use "button compounding" as the advance guide puts it.

So have I got this right with the following code

n=CP(b2)b15,66059 (means when I Hold button 2 and press b15 it'll do the action associated with 66059 (happens to be landing lights on)

n=CP(b2)b16,66060 (same as above with button 2 but this time b16 turns the landing lights off)

or do I need to change the CP to CR?

Share this post


Link to post
Share on other sites

n=CP(b2)b15,66059 (means when I Hold button 2 and press b15 it'll do the action associated with 66059 (happens to be landing lights on)

n=CP(b2)b16,66060 (same as above with button 2 but this time b16 turns the landing lights off)

You seem to be distorting the documented format somewhat.

First, the format has button numbers in the form "joystick number, button number". So your "b2", "b15" and "b16" would really be something like "1,2", "2,15", "2,16" assuming b2 was on joystick #1 and b15 and b16 were on joystick #2. Of course if you are using letters for joystick identification you'd use the letters instead of the numbers, but the comma is still needed.

Second, the condition (the part inside the () parentheses) needs a + or - character to start with to denote whether the condition is with that button PRESSED (+) or UNPRESSED (-). It isn't valid to omit that.

... or do I need to change the CP to CR?

Only if you are talking about having the action occur repeatedly whilst you are holding the activating button (15 or 16) down. I don't think you want that for light switches, though you might for a radio or dial adjustment or trim.

Pete

Share this post


Link to post
Share on other sites

My buttons are all on one joystick, the only reason I didn't include the j(x) bit to assign a joystick is because I looked at the fsuipc.ini file I have and under the [buttons] it doesn't use the j(x),b(x) format it just uses a button number. Does it make a difference that these buttons we're set up via the config screen in FSUIPC?

1=R1,14,C65588,0

2=R1,21,C65615,0

3=R1,19,C65607,0

4=P1,9,C66080,0

That's a section from my [buttons] bit, if you noticed its not actually saying a joystick number like you advanced guide says you need too, so I didn't include it in my code above since I was copying how it was already set out in my fsuipc.ini file.

Is that working as intended or not?

Share this post


Link to post
Share on other sites
My buttons are all on one joystick, the only reason I didn't include the j(x) bit to assign a joystick is because I looked at the fsuipc.ini file I have and under the [buttons] it doesn't use the j(x),b(x) format it just uses a button number.

No, that's not possible. There is always a joystick number.

Does it make a difference that these buttons we're set up via the config screen in FSUIPC?

1=R1,14,C65588,0

2=R1,21,C65615,0

3=R1,19,C65607,0

4=P1,9,C66080,0

That's a section from my [buttons] bit, if you noticed its not actually saying a joystick number like you advanced guide says you need too

Yes it is -- your joystick number is "1". What else do you think the "1" means?? The button definition in those four lines are 1,14 1,21 1,19 and 1,9 in that order. How are you not seeing the joystick number?

It will also appear in the place on the Buttons & Switches tab where the joyystick number shows. There is ALWAYS a joystick number.

Pete

Share this post


Link to post
Share on other sites

I thought I'd figured this out after you pointed me in the right direction but I get this now

19=CP(+1,4)1,8,65751,0 << ERROR 19! Line ignored >>

20=CP(+1,4)1,9,66240,0 << ERROR 19! Line ignored >>

According to your advanced user guide it says Error 19 is "The C.r K or M needed for Control,Key or Macro is missing"

is that saying then that button 4 on joy 1 is missing?

Sorry I keep bugging you with this, still trying to learn how to use FSUIPC.

Share this post


Link to post
Share on other sites
I thought I'd figured this out after you pointed me in the right direction but I get this now

19=CP(+1,4)1,8,65751,0 << ERROR 19! Line ignored >>

20=CP(+1,4)1,9,66240,0 << ERROR 19! Line ignored >>

According to your advanced user guide it says Error 19 is "The C.r K or M needed for Control,Key or Macro is missing"

is that saying then that button 4 on joy 1 is missing?

Sorry I keep bugging you with this, still trying to learn how to use FSUIPC.

I believe the problem is that the command offsets ( 65751 and 66240 ) require a "C" preceding them.

19=CP(+1,4)1,8,C65751,0

20=CP(+1,4)1,9,C66240,0

Try that.

Paul

Share this post


Link to post
Share on other sites
I thought I'd figured this out after you pointed me in the right direction but I get this now

19=CP(+1,4)1,8,65751,0 << ERROR 19! Line ignored >>

20=CP(+1,4)1,9,66240,0 << ERROR 19! Line ignored >>

According to your advanced user guide it says Error 19 is "The C.r K or M needed for Control,Key or Macro is missing"

is that saying then that button 4 on joy 1 is missing?

No, it is pointing out exactly what it says, you omitted the "C" saying that the large number is a Control, not a Key or a Macro. Please take a little more care copying things and you'll be okay.

Pete

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.