Advertisement
colhaydutu

roulette

Oct 21st, 2023 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. local tbl = {}
  2.  
  3. local function findMonitors()
  4. local monitors = {}
  5. for _, name in pairs(peripheral.getNames()) do
  6. if string.match(name, "^monitor_") then
  7. local monitor = peripheral.wrap(name)
  8. table.insert(monitors, monitor)
  9. end
  10. end
  11. return monitors
  12. end
  13.  
  14. local monitors = findMonitors()
  15.  
  16. local monitor = monitors[1]
  17. local modem = peripheral.wrap("back")
  18. modem.open(11)
  19.  
  20. local function initializeLamps()
  21. local lampNames = peripheral.getNames()
  22. table.sort(lampNames)
  23.  
  24. for _, v in ipairs(lampNames) do
  25. if peripheral.getType(v) == "colorful_lamp" then
  26. sleep(0.1)
  27. tbl[#tbl + 1] = peripheral.wrap(v)
  28. end
  29. end
  30. end
  31.  
  32. initializeLamps()
  33.  
  34. while true do
  35.  
  36. for i = 1, #tbl do
  37. tbl[i].setLampColor(32767) -- Lambalar her zaman beyaz olur
  38. end
  39. term.redirect(monitor)
  40. monitor.clear()
  41. paintutils.drawFilledBox(1, 1, 20, 5, colors.blue)
  42. paintutils.drawFilledBox(5,2,16,4,colors.white)
  43. paintutils.drawLine(1,6,20,6,colors.black)
  44.  
  45. paintutils.drawLine(1,6,1,14,colors.black)
  46. paintutils.drawLine(20,6,20,20,colors.black)
  47. paintutils.drawLine(1,10,20,10,colors.black)
  48.  
  49. monitor.setBackgroundColor(colors.white)
  50. monitor.setTextScale(2)
  51. monitor.setCursorPos(5, 3)
  52. monitor.setTextColor(colors.blue)
  53. monitor.write("{ ROULETTE }")
  54. monitor.setBackgroundColor(colors.lightGray)
  55.  
  56. local redstoneInput = redstone.getInput("bottom")
  57. sleep(0.1)
  58. if redstoneInput then
  59. local random = math.random(1, 22)
  60. for i = 1, random do
  61. tbl[i].setLampColor(30499) -- Sarı
  62. sleep(0.3)
  63. tbl[i].setLampColor(32767) -- Beyaz
  64.  
  65. if i == random then
  66. tbl[i].setLampColor(30499) -- Sarı
  67. if random == 1 or random == 3 or random == 5 or random == 7 or random == 9 or random == 12 or random == 14 or random == 16 or random == 18 or random == 20 then
  68. monitor.setTextScale(2)
  69. monitor.setBackgroundColor(colors.red)
  70. monitor.setCursorPos(8, 8)
  71.  
  72. monitor.setTextColor(colors.white)
  73. monitor.write("[RED]")
  74. sleep(5)
  75. elseif random == 2 or random == 4 or random == 6 or random == 8 or random == 10 or random == 13 or random == 15 or random == 17 or random == 19 or random == 22 then
  76. monitor.setTextScale(2)
  77. monitor.setBackgroundColor(colors.black)
  78. monitor.setCursorPos(7, 8)
  79. monitor.setTextColor(colors.white)
  80. monitor.write("[BLACK]")
  81. sleep(5)
  82. elseif random == 11 or random == 21 then
  83. monitor.setTextScale(2)
  84. monitor.setBackgroundColor(colors.lime)
  85. monitor.setCursorPos(7, 8)
  86. monitor.setTextColor(colors.white)
  87. monitor.write("[GREEN]")
  88. sleep(5)
  89. end
  90. end
  91. end
  92. end
  93. end
  94.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement