-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTolissCustom.lua
More file actions
536 lines (414 loc) · 18.2 KB
/
TolissCustom.lua
File metadata and controls
536 lines (414 loc) · 18.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
-- TolissXKeyPadHelper
-- Copyright (C) 2025 Ian Oliver
-- Version 1.9
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
print("[ *** IAN TolissXKeyPadHelper - Version 1.9 - 25 Deceber 2025" )
print("[ *** - aircraft type is... ]" )
print(PLANE_ICAO)
-- ToLiss only
if PLANE_ICAO == "A319" or PLANE_ICAO == "A321" or PLANE_ICAO == "A21N"
or PLANE_ICAO == "A20N" or PLANE_ICAO == "A346" or PLANE_ICAO == "A339" then
print("[ *** IAN TolissXKeyPadHelper: Script loaded for selected aircraft type ]" )
-- file:///C:/Users/ian/Downloads/FlyWithLua_Manual_en-1.pdf section 2.2.4
function PaxDoorsClose()
print("[ *** ian/PaxDoorsClose]" )
paxdoors = dataref_table( "AirbusFBW/PaxDoorModeArray")
paxdoors[0]=0
paxdoors[1]=0
paxdoors[2]=0
paxdoors[3]=0
paxdoors[4]=0
paxdoors[5]=0
paxdoors[6]=0
paxdoors[7]=0
end
function PaxGate1()
print("[ *** ian/PaxGate1]" )
paxdoors = dataref_table( "AirbusFBW/PaxDoorModeArray")
paxdoors[0]=2
paxdoors[1]=0
paxdoors[2]=0
paxdoors[3]=0
paxdoors[4]=0
paxdoors[5]=0
paxdoors[6]=0
paxdoors[7]=0
end
function PaxGate1R()
print("[ *** ian/PaxGate1R]" )
paxdoors = dataref_table( "AirbusFBW/PaxDoorModeArray")
paxdoors[0]=2
paxdoors[1]=0
paxdoors[2]=0
paxdoors[3]=0
paxdoors[4]=0
paxdoors[5]=0
paxdoors[6]=2
paxdoors[7]=0
end
function PaxGateAll()
print("[ *** ian/PaxGateAll]" )
paxdoors = dataref_table( "AirbusFBW/PaxDoorModeArray")
paxdoors[0]=2
paxdoors[1]=2
paxdoors[2]=0
paxdoors[3]=0
paxdoors[4]=0
paxdoors[5]=0
paxdoors[6]=2
paxdoors[7]=2
end
function PaxStand1()
print("[ *** ian/PaxStand1]" )
paxdoors = dataref_table( "AirbusFBW/PaxDoorModeArray")
paxdoors[0]=2
paxdoors[1]=0
paxdoors[2]=0
paxdoors[3]=0
paxdoors[4]=0
paxdoors[5]=0
paxdoors[6]=0
paxdoors[7]=0
end
function PaxStand1R()
print("[ *** ian/PaxStand1R]" )
paxdoors = dataref_table( "AirbusFBW/PaxDoorModeArray")
paxdoors[0]=2
paxdoors[1]=0
paxdoors[2]=0
paxdoors[3]=0
paxdoors[4]=0
paxdoors[5]=0
paxdoors[6]=2
paxdoors[7]=0
end
function PaxStandAll()
print("[ *** ian/PaxStandAll]" )
paxdoors = dataref_table( "AirbusFBW/PaxDoorModeArray")
paxdoors[0]=2
paxdoors[1]=2
paxdoors[2]=0
paxdoors[3]=0
paxdoors[4]=0
paxdoors[5]=0
paxdoors[6]=2
paxdoors[7]=2
end
function CargoDoorsOpen()
print("[ *** ian/CargoDoorOpen]" )
cargodoors = dataref_table( "AirbusFBW/CargoDoorModeArray")
cargodoors[0]=2
cargodoors[1]=2
cargodoors[2]=2
end
function CargoDoorsClose()
print("[ *** ian/CargoDoorClose]" )
cargodoors = dataref_table( "AirbusFBW/CargoDoorModeArray")
cargodoors[0]=0
cargodoors[1]=0
cargodoors[2]=0
end
function DUBright()
print("[ *** ian/DUBright]" )
dubrightness = dataref_table( "AirbusFBW/DUBrightness")
dubrightness[0]=1
dubrightness[1]=1
dubrightness[2]=1
dubrightness[3]=1
dubrightness[4]=1
dubrightness[5]=1
dubrightness[6]=1
dubrightness[7]=1
end
function DUMedium()
print("[ *** ian/DUMedium]" )
dubrightness = dataref_table( "AirbusFBW/DUBrightness")
dubrightness[0]=0.5
dubrightness[1]=0.5
dubrightness[2]=0.5
dubrightness[3]=0.5
dubrightness[4]=0.5
dubrightness[5]=0.5
dubrightness[6]=0.5
dubrightness[7]=0.5
end
function DUDim()
print("[ *** ian/DUDim]" )
dubrightness = dataref_table( "AirbusFBW/DUBrightness")
dubrightness[0]=0.2
dubrightness[1]=0.2
dubrightness[2]=0.2
dubrightness[3]=0.2
dubrightness[4]=0.2
dubrightness[5]=0.2
dubrightness[6]=0.2
dubrightness[7]=0.2
end
function IntegralBright()
print("[ *** ian/IntBright]" )
intbrightnesdataref = XPLMFindDataRef( "AirbusFBW/PanelBrightnessLevel")
fcurheostats = dataref_table( "AirbusFBW/SupplLightLevelRehostats")
XPLMSetDataf( intbrightnesdataref, 1.0 )
fcurheostats[0]=1.0
fcurheostats[1]=1.0
end
function IntegralMedium()
print("[ *** ian/IntMed]" )
intbrightnesdataref = XPLMFindDataRef( "AirbusFBW/PanelBrightnessLevel")
fcurheostats = dataref_table( "AirbusFBW/SupplLightLevelRehostats")
XPLMSetDataf( intbrightnesdataref, 0.5 )
fcurheostats[0]=0.4
fcurheostats[1]=0.6
end
function IntegralDim()
print("[ *** ian/IntDim]" )
intbrightnesdataref = XPLMFindDataRef( "AirbusFBW/PanelBrightnessLevel")
fcurheostats = dataref_table( "AirbusFBW/SupplLightLevelRehostats")
XPLMSetDataf( intbrightnesdataref, 0.1 )
fcurheostats[0]=0.025
fcurheostats[1]=0.1
end
function OHPBright()
print("[ *** ian/OHPBright]" )
ohpbrightnesdataref = XPLMFindDataRef( "AirbusFBW/OHPBrightnessLevel")
XPLMSetDataf( ohpbrightnesdataref, 1.0 )
end
function OHPMedium()
print("[ *** ian/OHPMed]" )
ohpbrightnesdataref = XPLMFindDataRef( "AirbusFBW/OHPBrightnessLevel")
XPLMSetDataf( ohpbrightnesdataref, 0.5 )
end
function OHPDim()
print("[ *** ian/OHPDim]" )
ohpbrightnesdataref = XPLMFindDataRef( "AirbusFBW/OHPBrightnessLevel")
XPLMSetDataf( ohpbrightnesdataref, 0.025 )
end
function CabinLightsOFF()
print("[ *** ian/CabinLightsOFF]" )
cabinlights = XPLMFindDataRef( "AirbusFBW/cabinLightLevel_perc")
XPLMSetDataf( cabinlights, 0.0 )
end
function CabinLightsTOLAND()
print("[ *** ian/CabinLightsTOLAND]" )
cabinlights = XPLMFindDataRef( "AirbusFBW/cabinLightLevel_perc")
XPLMSetDataf( cabinlights, 1.0 )
end
function CabinLightsMED()
print("[ *** ian/CabinLightsMED]" )
cabinlights = XPLMFindDataRef( "AirbusFBW/cabinLightLevel_perc")
XPLMSetDataf( cabinlights, 15.0 )
end
function CabinLightsON()
print("[ *** ian/CabinLightsON]" )
cabinlights = XPLMFindDataRef( "AirbusFBW/cabinLightLevel_perc")
XPLMSetDataf( cabinlights, 100.0 )
end
function FloodLightsOff()
print("[ *** ian/FloodLightsOff]" )
panelflood = XPLMFindDataRef( "AirbusFBW/PanelFloodBrightnessLevel")
pedestalflood = XPLMFindDataRef( "AirbusFBW/PedestalFloodBrightnessLevel")
XPLMSetDataf( panelflood, 0 )
XPLMSetDataf( pedestalflood, 0 )
end
function FloodLightsDim()
print("[ *** ian/FloodLightsDim]" )
panelflood = XPLMFindDataRef( "AirbusFBW/PanelFloodBrightnessLevel")
pedestalflood = XPLMFindDataRef( "AirbusFBW/PedestalFloodBrightnessLevel")
XPLMSetDataf( panelflood, 0.1 )
XPLMSetDataf( pedestalflood, 0.1 )
end
function FloodLightsBright()
print("[ *** ian/FloodLightsBright]" )
panelflood = XPLMFindDataRef( "AirbusFBW/PanelFloodBrightnessLevel")
pedestalflood = XPLMFindDataRef( "AirbusFBW/PedestalFloodBrightnessLevel")
XPLMSetDataf( panelflood, 1 )
XPLMSetDataf( pedestalflood, 1 )
end
function BrightnessNight()
print("[ *** ian/BrightnessNight ]" )
command_once("toliss_airbus/lightcommands/DomeLightDown") -- run twice to ensure dome lights off
command_once("toliss_airbus/lightcommands/DomeLightDown")
FloodLightsOff()
CabinLightsMED()
OHPDim()
IntegralDim()
DUBright()
end
function BrightnessNightDomeDim()
print("[ *** ian/BrightnessNightDomeDim ]" )
command_once("toliss_airbus/lightcommands/DomeLightDown") -- run twice to ensure dome lights off
command_once("toliss_airbus/lightcommands/DomeLightDown")
command_once("toliss_airbus/lightcommands/DomeLightUp") -- and once up to ensure dome lights are dim
FloodLightsOff()
CabinLightsMED()
OHPDim()
IntegralDim()
DUBright()
end
function PanelLightingOff()
print("[ *** ian/PanelLightingOff]" )
FloodLightsOff()
ohpbrightnesdataref = XPLMFindDataRef( "AirbusFBW/OHPBrightnessLevel")
XPLMSetDataf( ohpbrightnesdataref, 0.00 )
intbrightnesdataref = XPLMFindDataRef( "AirbusFBW/PanelBrightnessLevel")
fcurheostats = dataref_table( "AirbusFBW/SupplLightLevelRehostats")
XPLMSetDataf( intbrightnesdataref, 0 )
fcurheostats[0]=0
fcurheostats[1]=0
end
function RapidPowerOn()
print("[ *** ian/RapidPowerOn]" )
fuelohparray = dataref_table( "AirbusFBW/FuelOHPArray")
adirusarray = dataref_table( "AirbusFBW/ADIRUSwitchArray")
ohpswitches = dataref_table( "AirbusFBW/OHPLightSwitches")
crewoxy = XPLMFindDataRef( "AirbusFBW/CrewOxySwitch")
captpurs = XPLMFindDataRef( "ckpt/oh/capt/anim")
command_once("toliss_airbus/eleccommands/Bat1Toggle")
command_once("toliss_airbus/eleccommands/Bat2Toggle")
command_once("toliss_airbus/eleccommands/ExtPowToggle")
command_once("toliss_airbus/lightcommands/FSBSignOn")
command_once("toliss_airbus/lightcommands/NSSignUp") -- run twice to make sure Wifi is OFF
command_once("toliss_airbus/lightcommands/NSSignUp")
command_once("toliss_airbus/lightcommands/DomeLightUp") -- run twice to make sure dome is bright
command_once("toliss_airbus/lightcommands/DomeLightUp")
XPLMSetDatai( crewoxy, 1 )
fuelohparray[0]=1
fuelohparray[1]=1
fuelohparray[2]=1
fuelohparray[3]=1
fuelohparray[4]=1
fuelohparray[5]=1
fuelohparray[6]=1
adirusarray[0]=1
adirusarray[1]=1
adirusarray[2]=1
XPLMSetDatai( captpurs, 1 )
ohpswitches[9]=1 -- STBY Compass on
ohpswitches[10]=1 -- Emergency Exits arm
FloodLightsBright()
CabinLightsMED()
end
function RapidPowerOff()
print("[ *** ian/RapidPowerOff]" )
fuelohparray = dataref_table( "AirbusFBW/FuelOHPArray")
adirusarray = dataref_table( "AirbusFBW/ADIRUSwitchArray")
ohpswitches = dataref_table( "AirbusFBW/OHPLightSwitches")
crewoxy = XPLMFindDataRef( "AirbusFBW/CrewOxySwitch")
captpurs = XPLMFindDataRef( "ckpt/oh/capt/anim")
command_once("toliss_airbus/eleccommands/Bat1Toggle")
command_once("toliss_airbus/eleccommands/Bat2Toggle")
command_once("toliss_airbus/eleccommands/ExtPowToggle")
command_once("toliss_airbus/lightcommands/FSBSignOff")
command_once("toliss_airbus/lightcommands/NSSignUp") -- run twice to makesure Wifi is OFF
command_once("toliss_airbus/lightcommands/NSSignUp")
XPLMSetDatai( crewoxy, 0 )
fuelohparray[0]=0
fuelohparray[1]=0
fuelohparray[2]=0
fuelohparray[3]=0
fuelohparray[4]=0
fuelohparray[5]=0
fuelohparray[6]=0
adirusarray[0]=0
adirusarray[1]=0
adirusarray[2]=0
XPLMSetDatai( captpurs, 0 )
ohpswitches[9]=0 -- STBY Compass off
ohpswitches[10]=0 -- Emergency Exits off
CabinLightsOFF()
end
-- NB: AirbusFBW/WXPowerSwitch
-- This takes the value "0" when SYS 1 is on
-- This takes the value "1" when wx radar is off
-- This takes the value "2" when SYS 2 is on
function WXRadarToggle()
print("[ *** ian/WXRadarToggle]" )
wxsys = XPLMFindDataRef( "AirbusFBW/WXPowerSwitch")
gcs = XPLMFindDataRef( "ckpt/ped/radar/gcs/anim")
multiscan = XPLMFindDataRef( "ckpt/ped/radar/manAuto/anim")
val = XPLMGetDatai( wxsys )
if (val==0) -- sys1 on
then
XPLMSetDatai( wxsys, 1 ) -- set to off
XPLMSetDatai( gcs, 0 )
XPLMSetDatai( multiscan, 0 )
elseif (val==1) -- if off
then
XPLMSetDatai( wxsys, 2 ) -- set sys2
XPLMSetDatai( gcs, 1 )
XPLMSetDatai( multiscan, 1 )
elseif (val==2) -- if sys2 on
then
XPLMSetDatai( wxsys, 0 ) -- set sys1
XPLMSetDatai( gcs, 1 )
XPLMSetDatai( multiscan, 1 )
else
XPLMSetDatai( wxsys, 1 ) -- should never get here, but if it does, then set to off (This is unreachable code)
print("==========================================================================")
print("ian/WXRadarToggle reached unreachable code. Inform the author immediately. WXRadar is set to off for Xplanes sanity!")
print("You should raise an issue on the github page for this immediately: https://github.com/iolivergithub/TolissXKeyPadHelper")
print("==========================================================================")
end
end
function IanReadme()
print("[ *** ian/IanReadme]" )
print("==========================================================================")
print("TolissXKeyPadHelper")
print("Version 1.7 - 5 October 2025")
print("(C)2025 Ian Oliver.")
print("This software is released until teh GNU General Public License Version 3")
print("More information here: https://github.com/iolivergithub/TolissXKeyPadHelper")
print("Ensure you have read the README file at the above location. No warrany, no guarantees etc")
print("Issues, problems, suggestions, bug fixes etc, go here --> https://github.com/iolivergithub/TolissXKeyPadHelper/issues")
print("==========================================================================")
end
-- function AreBrakesHot()
-- print("[ *** ian/AreBrakesHot]" )
-- b = dataref_table( "AirbusFBW/BrakeTempArray")
-- if (b[0]>280 or b[1]>280 or b[2]>280 or b[3]>280) then
-- return 1
-- else
-- return 0
-- end
create_command("ian/PaxClose", "Close all passenger doors", "PaxDoorsClose()", "", "")
create_command("ian/PaxGate1", "Open pax front left only for gate arrival", "PaxGate1()", "", "")
create_command("ian/PaxGate1R", "Open pax front left, and rear+stairs for gate arrival", "PaxGate1R()", "", "")
create_command("ian/PaxGateALL", "Open pax all + trucks for gate arrival", "PaxGateAll()", "", "")
create_command("ian/PaxStand1", "Open pax front left only for stand arrival", "PaxStand1()", "", "")
create_command("ian/PaxStand1R", "Open pax front left, and rear+stairs for stand arrival", "PaxStand1R()", "", "")
create_command("ian/PaxStandALL", "Open pax all + trucks for stand arrival", "PaxStandAll()", "", "")
create_command("ian/CargoOpen", "Open all cargo doors", "CargoDoorsOpen()", "", "")
create_command("ian/CargoClose", "Close all cargo doors", "CargoDoorsClose()", "", "")
create_command("ian/DUBright", "Make all display units bright", "DUBright()", "", "")
create_command("ian/DUMedium", "Make all display units medium brightness", "DUMedium()", "", "")
create_command("ian/DUDim", "Make all display units dim", "DUDim()", "", "")
create_command("ian/IntegralBright", "Make integral bright", "IntegralBright()", "", "")
create_command("ian/IntegralMedium", "Make integral medium brightness", "IntegralMedium()", "", "")
create_command("ian/IntegralDim", "Make integral dim", "IntegralDim()", "", "")
create_command("ian/OHPBright", "Make overhead panel bright", "OHPBright()", "", "")
create_command("ian/OHPMedium", "Make overhead panel medium brightness", "OHPMedium()", "", "")
create_command("ian/OHPDim", "Make overhead panel dim", "OHPDim()", "", "")
create_command("ian/CabinLightsOFF", "Turn cabin lights off", "CabinLightsOFF()", "", "")
create_command("ian/CabinLightsTOLAND", "Turn cabin lights dim for takeoff/landing", "CabinLightsTOLAND()", "", "")
create_command("ian/CabinLightsMED", "Turn cabin lights to medium brightness", "CabinLightsMED()", "", "")
create_command("ian/CabinLightsON", "Turn cabin lights on", "CabinLightsON()", "", "")
create_command("ian/FloodLightsOff", "Turn cockpit floodlights off", "FloodLightsOff()", "", "")
create_command("ian/FloodLightsDim", "Make cockpit floodlights medium brightness", "FloodLightsDim()", "", "")
create_command("ian/FloodLightsBright", "Make cockpit floodlights bright", "FloodLightsBright()", "", "")
create_command("ian/RapidPowerOn", "Rapidly power on aircraft. Use only from cold and dark.", "RapidPowerOn()", "", "")
create_command("ian/RapidPowerOff", "Rapidly power off aircraft.", "RapidPowerOff()", "", "")
create_command("ian/BrightnessNight", "Convenience for setting up cockpit lights for night operation", "BrightnessNight()", "", "")
create_command("ian/BrightnessNightDomeDim", "Convenience for setting up cockpit lights for night operation but with dome lights dim", "BrightnessNightDomeDim()", "", "")
create_command("ian/PanelLightingOff", "Turn off panel lighting", "PanelLightingOff()", "", "")
create_command("ian/WXRadarToggle", "Convenience function for turning on WX radar", "WXRadarToggle()", "", "")
create_command("ian/Readme", "Prints README to log.txt", "IanReadme()", "", "")
end -- ToLiss only