Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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