View difference between Paste ID: Y2MS06j7 and 8VJ4aSqh
SHOW: | | - or go back to the newest paste.
1
local event = require("event")
2
local component = require("component")
3
local gpu = component.gpu
4
local kb = require("keyboard")
5
local os = require("os")
6
local term = require("term")
7
8
--[[
9
local primary = 81
10
local secondary = 69
11
local up = 38
12
local left = 37
13
local right = 39
14
local down = 40
15
]]--
16
function primaryButton()
17
  gpu.set(1, 1, "Primary Button  ")
18
end
19
20
function secondaryButton()
21
  gpu.set(1, 1, "Secondary Button")
22
end
23
24
function upButton()
25
  gpu.set(1, 1, "Up Button       ")
26
end
27
28
function leftButton()
29
  gpu.set(1, 1, "Left Button     ")
30
end
31
32
function rightButton()
33
  gpu.set(1, 1, "Right Button    ")
34
end
35
36
function downButton()
37
  gpu.set(1, 1, "Down Button     ")
38
end
39
40
while true do
41
	if kb.isKeyDown("q") == true then
42
		primaryButton()
43
	elseif kb.isKeyDown("e") == true then
44-
	elseif kb.isKeyDown("up") == true then
44+
45
	elseif kb.isKeyDown("w") == true then
46-
	elseif kb.isKeyDown("down") == true then
46+
47
	elseif kb.isKeyDown("s") == true then
48-
	elseif kb.isKeyDown("left") == true then
48+
49
	elseif kb.isKeyDown("a") == true then
50-
	elseif kb.isKeyDown("right") == true then
50+
51
	elseif kb.isKeyDown("d") == true then
52-
	else
52+
53-
		os.sleep(.5)
53+
	elseif kb.isControlDown() == true and kb.isKeyDown("c") == true then
54
		break
55
	end
56
	
57
	os.sleep(0.5)
58
	term.clear()
59
end