Created
June 17, 2019 16:37
-
-
Save brentpicasso/7a2e661648c2674e897f84e0e9a3bdb0 to your computer and use it in GitHub Desktop.
Percentage of Max Gsum calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Calculates and tracks how much of your maximum grip you are using, in real-time | |
setTickRate(25) | |
maxGsumId = addChannel("MaxGsum", 25, 2, -2.0, 2.0) | |
pctGsumMaxId = addChannel("PctMaxGsum", 25, 0, 0, 100) | |
maxGsum = 0 | |
function updateGsumStats() | |
local gsum = getChannel("Gsum") | |
if gsum ~= nil and gsum > 0 then | |
if gsum > maxGsum then maxGsum = gsum end | |
setChannel(maxGsumId, maxGsum) | |
setChannel(pctGsumMaxId, (gsum / maxGsum) * 100) | |
end | |
end | |
function onTick() | |
updateGsumStats() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment