Advertisement
Guest User

Untitled

a guest
Jul 11th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         secondaryButton()
  45.     elseif kb.isKeyDown("w") == true then
  46.         upButton()
  47.     elseif kb.isKeyDown("s") == true then
  48.         downButton()
  49.     elseif kb.isKeyDown("a") == true then
  50.         leftButton()
  51.     elseif kb.isKeyDown("d") == true then
  52.         rightButton()
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement