mirevall

redstone

Apr 10th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. -- 1.1.0
  2.  
  3. while true do
  4. term.clear()
  5. term.setCursorPos(1,1)
  6.  
  7. term.setTextColour(colours.blue)
  8. print("Redstone V 1.1.0")
  9. print(" ")
  10. term.setTextColour(colours.brown)
  11. print(" Input Output")
  12.  
  13. local Sides = redstone.getSides()
  14. local Values = {}
  15. local Out = {}
  16. local Inputs = {}
  17.  
  18. for i=1,#Sides do
  19. Side = redstone.getInput(Sides[i])
  20. Outp = redstone.getOutput(Sides[i])
  21. if Side == true then
  22. strSide = "true"
  23. else
  24. strSide = "false"
  25. end
  26. table.insert(Values, strSide)
  27. table.insert(Out, Outp)
  28. end
  29.  
  30. for g=1,#Sides do
  31. term.setTextColour(colours.brown)
  32. write(Sides[g])
  33. x, y = term.getCursorPos()
  34. term.setCursorPos(8,y)
  35. write(": ")
  36. if Values[g] == "true" then
  37. term.setTextColour(colours.green)
  38. else
  39. term.setTextColour(colours.red)
  40. end
  41. write(Values[g])
  42.  
  43. term.setTextColour(colours.brown)
  44. term.setCursorPos(16,y)
  45. write(", ")
  46. if Out[g] == true then
  47. term.setTextColour(colours.green)
  48. else
  49. term.setTextColour(colours.red)
  50. end
  51. print(Out[g])
  52. end
  53.  
  54. print(" ")
  55.  
  56. term.setTextColour(colours.yellow)
  57. write("@redstone>")
  58. input = read()
  59.  
  60. if input == "exit" then
  61. return false
  62. end
  63.  
  64. for i in string.gmatch(input, "%S+") do
  65. table.insert(Inputs, i)
  66. end
  67. if Inputs[2] == "on" then
  68. OnOrOff = true
  69. end
  70. if Inputs[2] == "off" then
  71. OnOrOff = false
  72. end
  73.  
  74. if Inputs[1] == "bottom" or Inputs[1] == "top" or Inputs[1] == "back" or Inputs[1] == "front" or Inputs[1] == "right" or Inputs[1] == "left" then
  75. redstone.setOutput(Inputs[1], OnOrOff)
  76. end
  77.  
  78. if input == "help" then
  79. term.setTextColour(colours.green)
  80. write("help")
  81. term.setTextColour(colours.white)
  82. print(" : shows this panel")
  83. term.setTextColour(colours.green)
  84. write("exit")
  85. term.setTextColour(colours.white)
  86. print(" : get out of here")
  87. print(" ")
  88. term.setTextColour(colours.white)
  89. write("SYNTAX : ")
  90. term.setTextColour(colours.green)
  91. write("[side] [on]")
  92. term.setTextColour(colours.white)
  93. write(" or ")
  94. term.setTextColour(colours.green)
  95. print("[off]")
  96. os.sleep(0.5)
  97. os.pullEvent( "key" )
  98. end
  99.  
  100. os.sleep(0.08)
  101. end
Add Comment
Please, Sign In to add comment