Last active
August 29, 2015 14:14
-
-
Save al42and/bd5b4bfa25c911eb7de9 to your computer and use it in GitHub Desktop.
Throw Trucks With Your Mind Connector for Myo armband
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
scriptId = 'com.aland.ttwym' | |
scriptDetailsUrl = 'https://gist.github.com/al42and/bd5b4bfa25c911eb7de9' | |
scriptTitle = 'Throw Trucks With Your Mind Connector' | |
--Andrey Alekseenko - Jan 23, 2015 | |
--http://throwtrucks.com/ | |
--Make a fist to activate powers | |
--Move hand to aim | |
--doubleTap to lock/unlock. | |
-- | |
-- | |
-- The control does not work when the game is started through the patcher/launcher. | |
-- Given you have latest patches installed, hit Win+R and type (with quotes) | |
-- "C:\Crooked Tree Studios\Throw Trucks With Your Mind\Binaries\Win32" | |
-- Or just go to installation folder and run "Throw Trucks With Your Mind.exe" manually. | |
-- | |
-- | |
--------------------------------------- | |
-- Locking Functions | |
-- Set how the Myo Armband handles locking | |
myo.setLockingPolicy("none") | |
--Toggle Unlock Functions | |
function lock() | |
enabled = false | |
myo.controlMouse(false) | |
myo.vibrate("short") | |
end | |
function unlock() | |
enabled = true | |
myo.controlMouse(true) | |
myo.vibrate("short") | |
end | |
--------------------------------------- | |
-- Myo Connect Functions | |
function onPoseEdge(pose, edge) | |
if edge == "on" then | |
if pose == "doubleTap" then | |
if enabled then | |
lock() | |
else | |
unlock() | |
end | |
elseif pose == "fist" and enabled then | |
myo.mouse("left","down") | |
end | |
elseif edge=="off" then | |
--Unlatch holding | |
myo.mouse("left","up") | |
end | |
end | |
-- onPeriodic runs every ~10ms | |
function onPeriodic() | |
end | |
function onActiveChange(isActive) | |
if isActive then | |
enabled = true | |
myo.controlMouse(true) | |
else | |
enabled = false | |
myo.controlMouse(false) | |
end | |
end | |
function onForegroundWindowChange(app, title) | |
if platform == "Windows" then | |
if app == "Throw Trucks With Your Mind.exe" then | |
return true | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment