Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local event = require("event")
- local component = require("component")
- local gpu = component.gpu
- local kb = require("keyboard")
- local os = require("os")
- local term = require("term")
- --[[
- local primary = 81
- local secondary = 69
- local up = 38
- local left = 37
- local right = 39
- local down = 40
- ]]--
- function primaryButton()
- gpu.set(1, 1, "Primary Button ")
- end
- function secondaryButton()
- gpu.set(1, 1, "Secondary Button")
- end
- function upButton()
- gpu.set(1, 1, "Up Button ")
- end
- function leftButton()
- gpu.set(1, 1, "Left Button ")
- end
- function rightButton()
- gpu.set(1, 1, "Right Button ")
- end
- function downButton()
- gpu.set(1, 1, "Down Button ")
- end
- while true do
- if kb.isKeyDown("q") == true then
- primaryButton()
- elseif kb.isKeyDown("e") == true then
- secondaryButton()
- elseif kb.isKeyDown("w") == true then
- upButton()
- elseif kb.isKeyDown("s") == true then
- downButton()
- elseif kb.isKeyDown("a") == true then
- leftButton()
- elseif kb.isKeyDown("d") == true then
- rightButton()
- elseif kb.isControlDown() == true and kb.isKeyDown("c") == true then
- break
- end
- os.sleep(0.5)
- term.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement