Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lua script for Keybow Mini Keyboard for Darkroom Twitch Stream
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