Advertisement
Guest User

test.lua

a guest
Jun 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.37 KB | None | 0 0
  1. --Written by rahph.
  2. --Send nukes                                                      I mean nudes
  3. --Anyway, config
  4. local tape0 = peripheral.wrap("tape_drive_3")
  5. local tape1 = peripheral.wrap("tape_drive_0")
  6. local tape2 = peripheral.wrap("tape_drive_2")
  7. local tape3 = peripheral.wrap("tape_drive_1")
  8. local lowestVolume = 0
  9. local defaultVolume = 0.5
  10. local highestVolume = 1
  11. local lowestSpeed = 0.25
  12. local defaultSpeed = 1
  13. local highestSpeed = 2
  14. --End config. Dont alter the program beyond this line unless you know what ya doin
  15. mon = peripheral.wrap("top")
  16. x,y = mon.getSize()
  17. function redraw(vol,speed,light)
  18. local objloc = {}
  19. objloc["tape"] = {}
  20. objloc.tape[1] = {}
  21. objloc.tape[1]["volume"] = {}
  22. objloc.tape[1]["volume"]["up"] = {}
  23. objloc.tape[1]["volume"]["down"] = {}
  24. objloc.tape[1]["speed"] = objloc.tape[1]["volume"]
  25. objloc.tape[2] = objloc.tape[1]
  26. objloc.tape[3] = objloc.tape[1]
  27. objloc.tape[4] = objloc.tape[1]
  28. objloc.light = {}
  29.  
  30. mon.setPaletteColor(colors.blue,0x23272A)
  31. mon.setPaletteColor(colors.white,0xFFFFFF)
  32. mon.clear()
  33. mon.setBackgroundColor(colors.blue)
  34. mon.clear()
  35. mon.setTextColor(colors.white)
  36. mon.setCursorPos(1,2)
  37. mon.setPaletteColor(colors.gray,0x99AAB5)
  38. mon.setTextColor(colors.gray)
  39. for i=1,x do mon.write("\127") end
  40. mon.setCursorPos(1,1)
  41. for i=1,x do mon.write("\127") end
  42. mon.setCursorPos(1,3)
  43. for i=1,x do mon.write("\127") end
  44. mon.setTextColor(colors.white)
  45. mon.setCursorPos((x-16)/2+1,2)
  46. mon.write(" DISCO CONTROLL ")
  47. mon.setCursorPos(((x/2)-6)/2,4)
  48. mon.write("TAPE 0")
  49. mon.setCursorPos((((x/2)-6)/2)+(x/2),4)
  50. mon.write("TAPE 1")
  51. mon.setCursorPos(((x/2)-6)/2,11)
  52. mon.write("TAPE 2")
  53. mon.setCursorPos((((x/2)-6)/2)+(x/2),11)
  54. mon.write("TAPE 3")
  55. mon.setTextColor(colors.gray)
  56. for i=4,y do mon.setCursorPos(25,i) mon.write("\127\127") end
  57. mon.setTextColor(colors.white)
  58. mon.setCursorPos((x/2)-10/2,18)
  59. mon.write("LIGHTS [ ]")
  60. mon.setTextColor(colors.gray)
  61. mon.setCursorPos(1,19)
  62. for i=1,x do mon.write("\127") end
  63. for i=1,y do mon.setCursorPos(1,i) mon.write("\127\127") end
  64. for i=1,y do mon.setCursorPos(x-1,i) mon.write("\127\127") end
  65. mon.setCursorPos(1,10)
  66. --for i=1,x do mon.write("\127") end
  67. --mon.setCursorPos(1,11)
  68. for i=1,x do mon.write("\127") end
  69.  
  70. mon.setCursorPos(1,17)
  71. for i=1,x do mon.write("\127") end
  72. mon.setCursorPos(((x/2)-6)/2,6)
  73. mon.write("VOLUME")
  74. mon.setCursorPos(((x/2)-6)/2,8)
  75. mon.write("SPEED:")
  76. mon.setCursorPos((((x/2)-6)/2)+(x/2),6)
  77. mon.write("VOLUME")
  78. mon.setCursorPos((((x/2)-6)/2)+(x/2),8)
  79. mon.write("SPEED:")
  80. mon.setCursorPos(((x/2)-6)/2,13)
  81. mon.write("VOLUME")
  82. mon.setCursorPos(((x/2)-6)/2,15)
  83. mon.write("SPEED:")
  84. mon.setCursorPos((((x/2)-6)/2)+(x/2),13)
  85. mon.write("VOLUME")
  86. mon.setCursorPos((((x/2)-6)/2)+(x/2),15)
  87. mon.write("SPEED:")
  88.  
  89. mon.setBackgroundColor(colors.white)
  90. objloc.tape[1].volume.down = ((x/2)-8)/2
  91. objloc.tape[1].volume.up = objloc.tape[1].volume.down + 7
  92. mon.setPaletteColor(colors.yellow,0x7289DA)
  93. mon.setBackgroundColor(colors.yellow)
  94. mon.setTextColor(colors.white)
  95. mon.setCursorPos(objloc.tape[1].volume.down,7)
  96. mon.write("\171      \187")
  97. mon.setBackgroundColor(colors.white)
  98. mon.setTextColor(colors.black)
  99. mon.setCursorPos(((x/2)-6)/2,7)
  100. mon.write("      ")
  101. if #tostring(vol[1]) % 2 == 1 then
  102. mon.setCursorPos(((x/2)-#tostring(vol[1]))/2-1,7)
  103. else
  104. mon.setCursorPos(((x/2)-#tostring(vol[1]))/2,7)
  105. end
  106. mon.write(vol[1])
  107. end
  108. redraw({1,1.02,0.25,2},{1,1,2,2},false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement