Jump to content
The simFlight Network Forums

[SOLVED] Compound buttons & LUA script


Recommended Posts

Can you please check the following syntax?
 
I have tried to integrate both programming methods since I couldn't find a proper example showing the usage of combined buttons and LUA parameters in the FSUIPC Advanced User manual. This one doesn't work - FSUIPC recognizes only the action button and the LUA parameter but skips the trigger (+0,28) button.

Is it possible to combine the two at all?!

...
27=CP(+0,28)0,8,CL1:R,65 ; battery              {ipcPARAM = 65 in the 1st LUA file is activated with button 8 on joy 0 while button 28 on joy 0 is pressed}
28=CP(+0,28)0,9,CL1:R,64 ; generator            {ipcPARAM = 64 in the 1st LUA file is activated with button 9 on joy 0 while button 28 on joy 0 is pressed}
...

Thanks!

Rustam

Link to comment
Share on other sites

Thanks, Roman!

 

I double checked the contents of the INI file, nothing suspicious or similar to what you have described... But a 2nd set of eyes is better anyway:

 

[JoyNames]
AutoAssignLetters=No
0=Saitek X52 Pro Flight Controller
0.GUID={355F3F90-50DC-11E5-8001-444553540000}
 

[LuaFiles]
1=SW_AN2
2=ipcReady
3=linda

 
[Profile.SW_AN2]
1=Antonov
 
[Buttons.SW_AN2]
0=CP(+0,28)0,4,CL1:R,1125 ; adf near-far switch
1=R0,6,CL1:R,780 ; mixture lean
2=R0,7,CL1:R,781 ; mixture enrich
3=CR(+0,18)0,6,CL1:R,812 ; prop pitch decr
4=CR(+0,18)0,7,CL1:R,813 ; prop pitch incr
5=R0,2,CL1:R,891 ; elevator trim down
6=R0,3,CL1:R,890 ; elevator trim up
7=P0,12,CL1:R,88 ; flaps up incr
8=P0,13,CL1:R,79 ; flaps down incr
9=P0,4,CL1:R,751 ; emerg flaps switch
10=P0,5,CL1:R,131 ; brakes
11=CP(+0,15)0,5,CL1:R,133 ; parking brakes
12=P0,1,CL1:R,1 ; cold & dark + autostart
13=U0,14,CL1:R,59 ; landing light left
14=P0,14,CL1:R,58 ; landing light right
15=P0,8,CL1:R,60 ; navigation light
16=P0,9,CL1:R,62 ; strobe light
17=P0,10,CL1:R,61 ; taxi light
18=P0,19,CL1:R,300 ; cockpit door
19=P0,21,CL1:R,301 ; pax door
20=CP(+0,15)0,21,CL1:R,302 ; cargo door
21=R0,20,CL1:R,900 ; aileron trim left
22=R0,22,CL1:R,901 ; aileron trim right
23=P0,31,CL1:R,132 ; manual pump
24=CP(+0,18)0,31,CL1:R,107 ; manual primer
25=CP(+0,15)0,31,CL1:R,57 ; tailwheel lock
26=CP(+0,15)0,25,CL1:R,1264 ; fuel tanks
27=CP(+0,15)0,8,CL1:R,65 ; battery
28=CP(+0,15)0,9,CL1:R,64 ; generator
29=CP(+0,15)0,23,CL1:R,804 ; magnetos
30=P0,23,CL1:R,920 ; cowl flaps incr
31=P0,25,CL1:R,921 ; cowl flaps decr
 
[Axes.SW_AN2]
RangeRepeatRate=10
0=0X,256,D,1,0,0,0
1=0Y,256,D,2,0,0,0
2=0Z,256,D,4,25,0,0
3=0R,256,D,3,0,0,0
 
[JoystickCalibration.SW_AN2]
Aileron=-16384,-512,512,16384
AileronTrimControl=0
AllowSuppressForPFCquad=Yes
ApplyHeloTrim=No
BrakeReleaseThreshold=0
CowlFlaps1Control=0
CowlFlaps2Control=0
CowlFlaps3Control=0
CowlFlaps4Control=0
Elevator=-16384,-512,512,16384
ExcludeMixtureSet=Yes
ExcludePropPitchSet=Yes
ExcludeThrottleSet=Yes
FlapDetents=No
FlapsSetControl=0
MaxSteerSpeed=60
MaxThrottleForReverser=256
Reverser1Control=66422
Reverser2Control=66425
Reverser3Control=66428
Reverser4Control=66431
Reverser=-16384,-11000
ReverserControl=66292
Rudder=-16384,-512,512,16384
RudderTrimControl=0
SepRevsJetsOnly=No
SlopeAileron=-2
SlopeElevator=-2
SlopeRudder=-3
SlopeThrottle=-4
SteeringTillerControl=0
Throttle=-9000,16384
UseAxisControlsForNRZ=No
 
[General]
AdvDisplayHotKey=65,11
AileronSpikeRemoval=Yes
AutoScanDevices=Yes
AutoTuneADF=No
AxesWrongRange=No
AxisCalibration=No
AxisIntercepts=No
BlankDisplays=No
BrakeReleaseThreshold=75
ClearWeatherDynamics=No
ClockSync=Yes
ClockSyncMins=1
CloudIcing=No
CloudTurbulence=No
Console=No
CustomWeatherModify=No
DelayedMouseLookZoom=No
DeleteVehiclesForAES=Yes
DirectAxesToCalibs=No
DisconnTrimForAP=Yes
DontResetAxes=No
ElevatorSpikeRemoval=Yes
EnableMouseLook=No
EventsViaCommands=Yes
FixControlAccel=Yes
FixMachSpeedBug=Yes
GenerateCirrus=No
GetNearestAirports=Yes
History=5A32BD8JRGOS3PH71NH2N
InitDelay=0
InitDelayDevicesToo=No
LoadFlightMenu=No
LoadPlanMenu=No
LuaRerunDelay=66
MagicBattery=No
MaxIce=-4
MaxSurfaceWind=0
MinIce=-4
MouseWheelMove=No
MouseWheelTrim=No
MouseWheelTrimSpeed=1
NewInterceptTextMenu=No
OneCloudLayer=No
OOMcheck=Yes
OOMcheckInterval=10
OwnWeatherChanges=No
PatchSIM1friction=Yes
PauseAfterCrash=Yes
PollGFTQ6=No
PressureSmoothness=0
ReversedElevatorTrim=No
RudderSpikeRemoval=Yes
SaveDataWithFlights=No
SavePreviousFlight=No
ShortAircraftNameOk=Substring
ShowMultilineWindow=Yes
ShowPMcontrols=No
SimConnectStallTime=1
SmoothBySimTime=No
SpoilerIncrement=512
SuppressAllGusts=No
SuppressCloudTurbulence=No
SuppressMultilineFS=No
SuppressSingleline=No
SuppressWindTurbulence=No
SuppressWindVariance=No
TCASid=Flight
TCASrange=40
TemperatureSmoothness=0
ThrottleSyncAll=No
TimeForSelect=4
TurbulenceDivisor=20,20,40,40
TurbulenceRate=1.0,5.0
UpdatedByVersion=4945
UpperWindGusts=No
UseMidMouseBtn=No
UseProfiles=Yes
UseSystemTime=No
VisibilityOptions=No
WeatherReadFactor=2
WeatherRewriteSeconds=1
WhiteMessages=Yes
WindAjustAltitude=No
WindAjustAltitudeBy=2000
WindDiscardLevel=400
WindLimitLevel=200
WindSmoothAirborneOnly=Yes
WindSmoothing=No
WindSmoothness=2
WindTurbulence=No
ZapSound=firework
ZeroElevForAPAlt=Yes
JoystickTimeout=20
ConsoleWindow=0,0,0,0
LogEvents=Yes
FSVersionUsed="Microsoft Flight Simulator X",10.0.61637.0
SimConnectUsed=10.0.61259.0
 
[Axes]
PollInterval=10
RangeRepeatRate=10
 
[Buttons]
PollInterval=25
ButtonRepeat=20,10
 
[JoystickCalibration]
Aileron=-16384,-512,512,16384
AileronTrimControl=0
AllowSuppressForPFCquad=Yes
ApplyHeloTrim=No
CowlFlaps1Control=0
CowlFlaps2Control=0
CowlFlaps3Control=0
CowlFlaps4Control=0
Elevator=-16384,-512,512,16384
ExcludeMixtureSet=Yes
ExcludePropPitchSet=Yes
ExcludeThrottleSet=Yes
FlapDetents=No
FlapsSetControl=0
MaxSteerSpeed=60
MaxThrottleForReverser=256
Reverser1Control=66422
Reverser2Control=66425
Reverser3Control=66428
Reverser4Control=66431
Reverser=-16384,-11000
ReverserControl=66292
Rudder=-16384,-512,512,16384
RudderTrimControl=0
SepRevsJetsOnly=No
SteeringTillerControl=0
Throttle=-16384,16384
UseAxisControlsForNRZ=No
 
[AutoSave]
AutoSaveEnabled=No
Files=10
Interval=60
Next=1
SaveOnGround=No
 
[GPSout]
GPSoutEnabled=No
Port=COM0
Speed=4800
Interval=2000
PosTo6Decimal=No
SimModeIndicator=No
Sentences=
 
[GPSout2]
GPSoutEnabled=No
Port=<none set>
Speed=4800
Interval=2000
PosTo6Decimal=No
SimModeIndicator=No
Sentences=
 
[WideServer]
WideFSenabled=Yes
 
[Window.LUA display]
Docked=7354, 2828, 3545, 2459

 

Thanks!

 

Rustam

Link to comment
Share on other sites

Rustam,

 

I would give this a try. All my compounds require the alternate trigger. Below are all the buttons that may be conflicting - color coded matching.

 

[buttons.SW_AN2]
0=CP(+0,28)0,4,CL1:R,1125 ; adf near-far switch
1=R0,6,CL1:R,780 ; mixture lean
2=R0,7,CL1:R,781 ; mixture enrich
3=CR(+0,18)0,6,CL1:R,812 ; prop pitch decr
4=CR(+0,18)0,7,CL1:R,813 ; prop pitch incr
5=R0,2,CL1:R,891 ; elevator trim down
6=R0,3,CL1:R,890 ; elevator trim up
7=P0,12,CL1:R,88 ; flaps up incr
8=P0,13,CL1:R,79 ; flaps down incr
9=P0,4,CL1:R,751 ; emerg flaps switch
10=P0,5,CL1:R,131 ; brakes
11=CP(+0,15)0,5,CL1:R,133 ; parking brakes
12=P0,1,CL1:R,1 ; cold & dark + autostart
13=U0,14,CL1:R,59 ; landing light left
14=P0,14,CL1:R,58 ; landing light right
15=P0,8,CL1:R,60 ; navigation light
16=P0,9,CL1:R,62 ; strobe light
17=P0,10,CL1:R,61 ; taxi light
18=P0,19,CL1:R,300 ; cockpit door
19=P0,21,CL1:R,301 ; pax door
20=CP(+0,15)0,21,CL1:R,302 ; cargo door
21=R0,20,CL1:R,900 ; aileron trim left
22=R0,22,CL1:R,901 ; aileron trim right
23=P0,31,CL1:R,132 ; manual pump
24=CP(+0,18)0,31,CL1:R,107 ; manual primer
25=CP(+0,15)0,31,CL1:R,57 ; tailwheel lock
26=CP(+0,15)0,25,CL1:R,1264 ; fuel tanks
27=CP(+0,15)0,8,CL1:R,65 ; battery
28=CP(+0,15)0,9,CL1:R,64 ; generator
29=CP(+0,15)0,23,CL1:R,804 ; magnetos
30=P0,23,CL1:R,920 ; cowl flaps incr

31=P0,25,CL1:R,921 ; cowl flaps decr 

 

So as an example take a look at entries 23-25, they require multiple compound triggers.

23=P0,31,CL1:R,132 ; manual pump
24=CP(+0,18)0,31,CL1:R,107 ; manual primer
25=CP(+0,15)0,31,CL1:R,57 ; tailwheel lock

At least in my case you must follow the opposite triggers in order for it to work correctly. Basically you have to tell FSUIPC to get the state of all the buttons when 1 action button has a compound. They are not assumed as unpressed. Edit - Another way of thinking about it is - an action button can be either a press or a compound, but not both. 

23=CP(-0,15)(-0,18)0,31,CL1:R,132 ; manual pump - 15 & 18 unpressed, 31 pressed
24=CP(-0,15)(+0,18)0,31,CL1:R,107 ; manual primer - 15 unpressed, 18 & 31 pressed
25=CP(+0,15)(-0,18)0,31,CL1:R,57 ; tailwheel lock - 15 & 31 pressed, 18 unpressed

A second, easier example, for generator and strobe light.

 

Original - 

16=P0,9,CL1:R,62 ; strobe light 
28=CP(+0,15)0,9,CL1:R,64 ; generator

New - 

16=CP(-0,15)0,9,CL1:R,62 ; strobe light - 15 unpressed, 9 pressed
28=CP(+0,15)0,9,CL1:R,64 ; generator - 15 & 9 pressed

For me a good tip is to reorder your buttons so the action buttons are paired up with the triggers. It will prevent a big headache!  :smile:  entries 10-11, 19-20, 23-25 & 29-30 are a good example of doing it.

Link to comment
Share on other sites

Roman,

 

Thanks a lot! I followed your tips and guess what - it works, although a bit unexpectedly! :D

 

 

Basically you have to tell FSUIPC to get the state of all the buttons when 1 action button has a compound. They are not assumed as unpressed. Edit - Another way of thinking about it is - an action button can be either a press or a compound, but not both.

 

 

I see your point... The lesson learnt: the key, as you have also mentioned, is the state of all buttons involved in compound button programming, not what one expects them to do even if the syntax I posted in OP is pretty much logical...

 

Have a nice day!

 

Rustam

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.