Skip to content

Instantly share code, notes, and snippets.

@brentpicasso
Created June 17, 2019 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentpicasso/7a2e661648c2674e897f84e0e9a3bdb0 to your computer and use it in GitHub Desktop.
Save brentpicasso/7a2e661648c2674e897f84e0e9a3bdb0 to your computer and use it in GitHub Desktop.
Percentage of Max Gsum calculator
-- 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