HDR

Music System Pocket Client

HDR
Aug 25th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --# Made By HDR - @MartinRefseth #--
  2. --# Version 1.1 Remote Client #-
  3. --# Thanks to Lyqyd for his Button API http://www.computercraft.info/forums2/index.php?/topic/14784-touchpoint-api/ #--
  4. os.loadAPI("touchpoint")
  5. rednet.open("back")
  6. local page1 = touchpoint.new()
  7. local page2 = touchpoint.new()
  8. local t
  9. local input = io.input()
  10. local id = nil
  11.  
  12. if fs.exists("id.txt") ~= true then
  13.  mswrite = fs.open("id.txt", "w")
  14.  term.clear()
  15.  term.setCursorPos(1,1)
  16.  term.setTextColor(colors.orange)
  17.  term.setBackgroundColor(colors.gray)
  18.  print("Enter"," "..os.getComputerID()," ","Into The Server")
  19.  term.setCursorPos(1,2)
  20.  term.write("Insert Server ID ")
  21.  local idinput = read()
  22.  idput = idinput
  23.  mswrite.write(idput)
  24.  mswrite.close()
  25. end
  26.  
  27. function idCheck()
  28. fileHandler = io.open( "id.txt", "r" )
  29. content = fileHandler:read("*a")
  30. fileHandler:close()
  31. id = tonumber(content)
  32. end
  33.  
  34. function pg1()
  35.     page2:flash("Page 1")
  36.     t = page1
  37. --#OverWrites Part Of Touchpoint API#--
  38.     t.draw = function(self)
  39.                 local old = term.redirect(self.mon)
  40.                 term.setTextColor(colors.white)
  41.                 term.setBackgroundColor(colors.gray)
  42.                 term.clear()
  43.                 term.setCursorPos(1,20)
  44.                 term.setTextColor(colors.orange)
  45.                 term.write("v1.0")
  46.                 for name, buttonData in pairs(self.buttonList) do
  47.                         if buttonData.active then
  48.                                 term.setBackgroundColor(buttonData.activeColor)
  49.                                 term.setTextColor(buttonData.activeText)
  50.                         else
  51.                                 term.setBackgroundColor(buttonData.inactiveColor)
  52.                                 term.setTextColor(buttonData.inactiveText)
  53.                         end
  54.                         for i = buttonData.yMin, buttonData.yMax do
  55.                                 term.setCursorPos(buttonData.xMin, i)
  56.                                 term.write(buttonData.label[i - buttonData.yMin + 1])
  57.                         end
  58.                 end
  59.                 if old then
  60.                         term.redirect(old)
  61.                 else
  62.                         term.restore()
  63.                 end
  64.         end
  65. end
  66.  
  67. function pg2()
  68.     page1:flash("Page 2")
  69.     t = page2
  70. --#OverWrites Part Of Touchpoint API#--
  71.     t.draw = function(self)
  72.                 local old = term.redirect(self.mon)
  73.                 term.setTextColor(colors.white)
  74.                 term.setBackgroundColor(colors.gray)
  75.                 term.clear()
  76.                 term.setCursorPos(23,20)
  77.                 term.setTextColor(colors.orange)
  78.                 term.write("v1.0")
  79.                 for name, buttonData in pairs(self.buttonList) do
  80.                         if buttonData.active then
  81.                                 term.setBackgroundColor(buttonData.activeColor)
  82.                                 term.setTextColor(buttonData.activeText)
  83.                         else
  84.                                 term.setBackgroundColor(buttonData.inactiveColor)
  85.                                 term.setTextColor(buttonData.inactiveText)
  86.                         end
  87.                         for i = buttonData.yMin, buttonData.yMax do
  88.                                 term.setCursorPos(buttonData.xMin, i)
  89.                                 term.write(buttonData.label[i - buttonData.yMin + 1])
  90.                         end
  91.                 end
  92.                 if old then
  93.                         term.redirect(old)
  94.                 else
  95.                         term.restore()
  96.                 end
  97.         end
  98. end
  99.  
  100. function main()
  101.     t = page1
  102. --#OverWrites Part Of Touchpoint API#--
  103.     t.draw = function(self)
  104.                 local old = term.redirect(self.mon)
  105.                 term.setTextColor(colors.white)
  106.                 term.setBackgroundColor(colors.gray)
  107.                 term.clear()
  108.                 term.setCursorPos(1,20)
  109.                 term.setTextColor(colors.orange)
  110.                 term.write("v1.0")
  111.                 for name, buttonData in pairs(self.buttonList) do
  112.                         if buttonData.active then
  113.                                 term.setBackgroundColor(buttonData.activeColor)
  114.                                 term.setTextColor(buttonData.activeText)
  115.                         else
  116.                                 term.setBackgroundColor(buttonData.inactiveColor)
  117.                                 term.setTextColor(buttonData.inactiveText)
  118.                         end
  119.                         for i = buttonData.yMin, buttonData.yMax do
  120.                                 term.setCursorPos(buttonData.xMin, i)
  121.                                 term.write(buttonData.label[i - buttonData.yMin + 1])
  122.                         end
  123.                 end
  124.                 if old then
  125.                         term.redirect(old)
  126.                 else
  127.                         term.restore()
  128.                 end
  129.         end
  130. end
  131.  
  132. function Thir()
  133.  t:flash("13")
  134.  idCheck()
  135.  rednet.send(id,"Thir")
  136. end
  137.  
  138. function Cat()
  139.  t:flash("Cat")
  140.  idCheck()
  141.  rednet.send(id,"Cat")
  142. end
  143.  
  144. function Blocks()
  145.  t:flash("Blocks")
  146.  idCheck()
  147.  rednet.send(id,"Blocks")
  148. end
  149.  
  150. function Chirp()
  151.  t:flash("Chirp")
  152.  idCheck()
  153.  rednet.send(id,"Chirp")
  154. end
  155.  
  156. function Far()
  157.  t:flash("Far")
  158.  idCheck()
  159.  rednet.send(id,"Far")
  160. end
  161.  
  162. function Mall()
  163.  t:flash("Mall")
  164.  idCheck()
  165.  rednet.send(id,"Mall")
  166. end
  167.  
  168. function Mellohi()
  169.  t:flash("Mellohi")
  170.  idCheck()
  171.  rednet.send(id,"Mellohi")
  172. end
  173.  
  174. function Stal()
  175.  t:flash("Stal")
  176.  idCheck()
  177.  rednet.send(id,"Stal")
  178. end
  179.  
  180. function Strad()
  181.  t:flash("Strad")
  182.  idCheck()
  183.  rednet.send(id,"Strad")
  184. end
  185.  
  186. function Ward()
  187.  t:flash("Ward")
  188.  idCheck()
  189.  rednet.send(id,"Ward")
  190. end
  191.  
  192. function Elev()
  193.  t:flash("11")
  194.  idCheck()
  195.  rednet.send(id,"Elev")
  196. end
  197.  
  198. function Wait()
  199.  t:flash("Wait")
  200.  idCheck()
  201.  rednet.send(id,"Wait")
  202. end
  203.  
  204. function Question()
  205.  t:flash("???")
  206.  idCheck()
  207.  rednet.send(id,"Question")
  208. end
  209.  
  210. function GaiaOne()
  211.  t:flash("Gaia 1")
  212.  idCheck()
  213.  rednet.send(id,"GaiaOne")
  214. end
  215.  
  216. function GaiaTwo()
  217.  t:flash("Gaia 2")
  218.  idCheck()
  219.  rednet.send(id,"GaiaTwo")
  220. end
  221.  
  222. function Roop()
  223.  t:flash("R-Loop")
  224.  idCheck()
  225.  rednet.send(id,"Roop")
  226. end
  227.  
  228. function Slive()
  229.  t:flash("S-Alive")
  230.  idCheck()
  231.  rednet.send(id,"Slive")
  232. end
  233.  
  234. function WYG()
  235.  t:flash("WYG")
  236.  idCheck()
  237.  rednet.send(id,"WYG")
  238. end
  239.  
  240. function WDR()
  241.  t:flash("Wanderer")
  242.  idCheck()
  243.  rednet.send(id,"WDR")
  244. end
  245.  
  246. function Stop()
  247.  t:flash("Stop")
  248.  idCheck()
  249.  rednet.send(id,"Stop")
  250. end
  251.  
  252. function Reboot()
  253.  t:flash("Reboot")
  254.  idCheck()
  255.  rednet.send(id,"Reboot")
  256.  os.reboot()
  257. end
  258.  
  259. function Random()
  260.  t:flash("Random")
  261.  idCheck()
  262.  rednet.send(id,"Random")
  263. end
  264.  
  265. do
  266.  page1:add("13", Thir, 2,3,8,5, colors.cyan, colors.lime, colors.orange, colors.orange)
  267.  page1:add("Cat", Cat, 10,3,17,5, colors.cyan, colors.lime, colors.orange, colors.orange)
  268.  page1:add("Blocks", Blocks, 19,3,25,5, colors.cyan, colors.lime, colors.orange, colors.orange)
  269.  page1:add("Chirp", Chirp, 2,7,8,9, colors.cyan, colors.lime, colors.orange, colors.orange)
  270.  page1:add("Far", Far, 10,7,17,9, colors.cyan, colors.lime, colors.orange, colors.orange)
  271.  page1:add("Mall", Mall, 19,7,25,9, colors.cyan, colors.lime, colors.orange, colors.orange)
  272.  page1:add("Mellohi", Mellohi, 2,11,8,13, colors.cyan, colors.lime, colors.orange, colors.orange)
  273.  page1:add("Stal", Stal, 10,11,17,13, colors.cyan, colors.lime, colors.orange, colors.orange)
  274.  page1:add("Strad", Strad, 19,11,25,13, colors.cyan, colors.lime, colors.orange, colors.orange)
  275.  page1:add("Ward", Ward, 2,15,8,17, colors.cyan, colors.lime, colors.orange, colors.orange)
  276.  page1:add("11", Elev, 10,15,17,17, colors.cyan, colors.lime, colors.orange, colors.orange)
  277.  page1:add("Wait", Wait, 19,15,25,17, colors.cyan, colors.lime, colors.orange, colors.orange)
  278.  page1:add("Stop", Stop, 10,1,17,1, colors.cyan, colors.lime, colors.orange, colors.orange)
  279.  page1:add("Reboot", Reboot, 19,1,26,1, colors.cyan, colors.lime, colors.orange, colors.orange)
  280.  page1:add("Random", Random, 1,1,8,1, colors.cyan, colors.lime, colors.orange, colors.orange)
  281.  page1:add("Page 2", pg2, 19,20,26,20, colors.cyan, colors.lime, colors.orange, colors.orange)
  282.  
  283.  page2:add("Gaia 1", GaiaOne, 4,3,12,5, colors.cyan, colors.lime, colors.orange, colors.orange)
  284.  page2:add("Gaia 2", GaiaTwo, 15,3,23,5, colors.cyan, colors.lime, colors.orange, colors.orange)
  285.  page2:add("???", Question, 4,7,12,9, colors.cyan, colors.lime, colors.orange, colors.orange)
  286.  page2:add("R-Loop", Roop, 15,7,23,9, colors.cyan, colors.lime, colors.orange, colors.orange)
  287.  page2:add("S-Alive", Slive, 4,11,12,13, colors.cyan, colors.lime, colors.orange, colors.orange)
  288.  page2:add("WYG", WYG, 15,11,23,13, colors.cyan, colors.lime, colors.orange, colors.orange)
  289.  page2:add("Wanderer", WDR, 9,15,18,17, colors.cyan, colors.lime, colors.orange, colors.orange)
  290.  page2:add("Page 1", pg1, 1,20,8,20, colors.cyan, colors.lime, colors.orange, colors.orange)
  291.  page2:add("Stop", Stop, 10,1,17,1, colors.cyan, colors.lime, colors.orange, colors.orange)
  292.  page2:add("Reboot", Reboot, 19,1,26,1, colors.cyan, colors.lime, colors.orange, colors.orange)
  293.  page2:add("Random", Random, 1,1,8,1, colors.cyan, colors.lime, colors.orange, colors.orange)
  294. end
  295.  
  296. main()
  297. while true do
  298.     t:draw()
  299.     local event, p1 = t:handleEvents(os.pullEvent())
  300.     if event == "button_click" then
  301.         t.buttonList[p1].func()
  302.     end
  303. end
Add Comment
Please, Sign In to add comment