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/MCDU/PERFCLB.nas

36 lines
996 B
Text
Raw Normal View History

2019-05-08 23:27:26 +00:00
# A3XX mCDU by Joshua Davidson (Octal450) and Jonathan Redpath
2019-05-08 23:27:26 +00:00
# Copyright (c) 2019 Joshua Davidson (Octal450)
var perfCLBInput = func(key, i) {
var scratchpad = getprop("/MCDU[" ~ i ~ "]/scratchpad");
if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad-msg", 0);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci == nil) {
notAllowed(i);
} else if (ci >= 0 and ci <= 999) {
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/MCDU[" ~ i ~ "]/scratchpad", "");
} else {
notAllowed(i);
}
} else {
notAllowed(i);
}
}
} else if (key == "L6") {
setprop("/MCDU[" ~ i ~ "]/page", "TO");
} else if (key == "R6") {
setprop("/MCDU[" ~ i ~ "]/page", "CRZ");
}
}