Created
April 4, 2020 15:44
-
-
Save kianryan/f726dd8a4c47e254e337ee6986321147 to your computer and use it in GitHub Desktop.
Lua script for Keybow Mini Keyboard for Darkroom Twitch Stream
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
require "keybow" | |
-- MACRO controls for darkroom Twitch. | |
-- SHIFT 0 (RED) | |
-- Middle Button : You awake... | |
-- Right Button : Because it's dark .. | |
-- SHIFT 1 (GREEN) | |
-- Middle Button : You go in a direction... | |
-- Right Button : How will you find .. | |
-- SHIFT 2 (BLUE) | |
-- Middle Button : Bullshit you see ... | |
-- Right Button : Ya die, ya die, ya die! .. | |
function setup() | |
keybow.use_mini() | |
keybow.auto_lights(false) | |
keybow.clear_lights() | |
set_colours() | |
end | |
shift = 0 | |
sequence = {{255,0,0}, {0,255,0}, {0,0,255}} | |
function set_colours() | |
-- Don't forget lua tables index at 1 | |
colour = sequence[shift + 1] | |
keybow.set_pixel(0, colour[1], colour[2], colour[3]) | |
keybow.set_pixel(1, colour[1], colour[2], colour[3]) | |
keybow.set_pixel(2, colour[1], colour[2], colour[3]) | |
end | |
-- Key mappings -- | |
function handle_minikey_00(pressed) -- First key is shift key. | |
if pressed then | |
shift = (shift + 1) % 3; | |
set_colours() | |
end | |
end | |
function handle_minikey_01(pressed) | |
if pressed then | |
if shift == 0 then | |
keybow.text("YOU AWAKE TO FIND YOURSELF IN A DARK ROOM.\n") | |
elseif shift == 1 then | |
keybow.text("YOU GO IN A DIRECTION YOU BELIVE TO BE NORTH, HOW CAN YOU BE SURE, YOU'RE IN A DARK ROOM?\n") | |
else | |
keybow.text("BULLSHIT YOU SEE. YOU'RE IN A DARK ROOM!\n") | |
end | |
end | |
end | |
function handle_minikey_02(pressed) | |
if pressed then | |
if shift == 0 then | |
keybow.text("BECAUSE IT'S DARK DARREN, AND A ROOM DARREN, AND YOU'RE AWAKE IN IT DARREN.\n") | |
elseif shift == 1 then | |
keybow.text("HOW WILL YOU FIND THE LIGHT SWITCH? YOU'RE IN A DARK ROOM! YOU NEED THE LIGHT SWITCH TO SEE! DO YOU SEE?\n") | |
else | |
keybow.text("YA DIE! YA DIE! YA DIE! YA DIE! YA DIE! YA DIE! YA DIE! YA DIE! YA DIE! YA DIE!\n") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment