This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Nasal/MCDU2/PERFCLB.nas

50 lines
1.6 KiB
Text
Raw Normal View History

2017-07-14 15:57:14 +00:00
# A3XX mCDU by Joshua Davidson (it0uchpods) and Jonathan Redpath
2017-08-16 20:53:35 +00:00
#########################################
# Copyright (c) it0uchpods Design Group #
#########################################
2017-06-30 15:45:41 +00:00
var perfCLBInput = func(key) {
2017-07-30 17:36:04 +00:00
var scratchpad = getprop("/MCDU[1]/scratchpad");
2017-06-30 15:45:41 +00:00
if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
2017-07-30 17:36:04 +00:00
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/scratchpad", "");
2017-06-30 15:45:41 +00:00
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci == nil) {
2017-07-30 17:36:04 +00:00
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
2017-06-30 15:45:41 +00:00
}
2017-07-30 17:36:04 +00:00
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
2017-07-29 19:35:38 +00:00
} else if (ci >= 0 and ci <= 999) {
2017-06-30 15:45:41 +00:00
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
2017-07-30 17:36:04 +00:00
setprop("/MCDU[1]/scratchpad", "");
2017-06-30 15:45:41 +00:00
} else {
2017-07-30 17:36:04 +00:00
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
2017-06-30 15:45:41 +00:00
}
2017-07-30 17:36:04 +00:00
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
2017-06-30 15:45:41 +00:00
}
} else {
2017-07-30 17:36:04 +00:00
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
2017-06-30 15:45:41 +00:00
}
2017-07-30 17:36:04 +00:00
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
2017-06-30 15:45:41 +00:00
}
}
} else if (key == "L6") {
2017-07-30 17:36:04 +00:00
setprop("/MCDU[1]/page", "TO");
2017-06-30 15:45:41 +00:00
} else if (key == "R6") {
2017-07-30 17:36:04 +00:00
setprop("/MCDU[1]/page", "CRZ");
2017-06-30 15:45:41 +00:00
}
}