From cea195a85b2ce0b4c852001d60cebee0a90d2350 Mon Sep 17 00:00:00 2001 From: annabunches <annabunches@gmail.com> Date: Thu, 22 Jul 2021 13:38:19 -0400 Subject: [PATCH] Add some scratch bits of code that may one day be useful. --- scratch/math.ks | 9 +++++++++ scratch/misc.ks | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 scratch/math.ks create mode 100644 scratch/misc.ks diff --git a/scratch/math.ks b/scratch/math.ks new file mode 100644 index 0000000..dfd7b16 --- /dev/null +++ b/scratch/math.ks @@ -0,0 +1,9 @@ +@lazyglobal off. + +function Bound { + parameter minB. + parameter maxB. + parameter value. + + return min(max(value, minB), maxB). +} diff --git a/scratch/misc.ks b/scratch/misc.ks new file mode 100644 index 0000000..cf0fe7e --- /dev/null +++ b/scratch/misc.ks @@ -0,0 +1,15 @@ +// Check for various sensors and set appropriate global constants. +// Currently only checks for grav sensor, as that's the only one used by this library. +// global HAS_GRAV_SENSOR is false. +// function SensorCheck { +// local SensorList is 0. +// list SENSORS in SensorList. +// for s in SensorList { +// if s:type = "grav" { +// print "Gravometric sensor detected". +// set HAS_GRAV_SENSOR to true. +// return. +// } +// } +// set HAS_GRAV_SENSOR to false. +// }