ByteZz

Touchpoint Tests

Mar 12th, 2014
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. loadup = function()
  2.         shell.run("pastebin", "get", "pFHeia96", "touchpoint")
  3.         os.loadAPI("touchpoint")
  4.         print("Touchpoint API Loaded")
  5.         sleep(1)
  6.         term.clear()
  7.         term.setCursorPos(1,1)
  8. end
  9.  
  10. buttonLoads = function()
  11.     local t = touchpoint.new("top")
  12.         t:add("Wither", leftAction, 2, 2, 14, 5, colors.orange, colors.red)
  13.         t:add("Blaze",  backAction, 9, 8, 21, 11, colors.gray, colors.red)
  14.         t:add("Spider", rightAction, 16, 2, 28, 5, colors.blue, colors.red)
  15.         t:draw()
  16. end
  17.  
  18. function leftAction()
  19.         t:toggleButton("Wither")
  20.         if rs.getInput("left") == true then
  21.                 rs.setOutput("left", false)
  22.         else
  23.                 rs.setOutput("left", true)
  24.         end
  25. end
  26.  
  27. function backAction()
  28.         t:toggleButton("Blaze")
  29.         if rs.getInput("back") == true then
  30.                 rs.setOutput("back", false)
  31.         else
  32.                 rs.setOutput("back", true)
  33.         end
  34. end
  35.  
  36. function rightAction()
  37.         t:toggleButton("Spider")
  38.         if rs.getInput("right") == true then
  39.                 rs.setOutput("right", false)
  40.         else
  41.                 rs.setOutput("right", true)
  42.         end
  43. end
  44.  
  45. loadup()
  46. buttonLoads()
  47. t:run()
RAW Paste Data