Advertisement
SythsGod

Enderchest Colors

Mar 7th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. local chest = peripheral.wrap("left")
  2.  
  3. local colors = {"white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black"}
  4.  
  5. -- On Startup
  6. term.clear()
  7. term.setCursorPos(1,1)
  8.  
  9. print("Possibles entries:")
  10.  
  11. local whatColorFirst = 0
  12. local whatColorSecond = 0
  13. local whatColorThird = 0
  14.  
  15. for i = 1, #colors,2 do
  16.     print(colors[i].." | "..colors[i + 1])
  17. end
  18.  
  19. print(" ")
  20.  
  21. print("Give first color:")
  22. local first = read()
  23.  
  24. print("Give second color:")
  25. local second = read()
  26.  
  27. print("Give third color:")
  28. local third = read()
  29.  
  30. -- Decide what color the first one is
  31. for i = 1, #colors do
  32.     if first == colors[i] then whatColorFirst = i - 1 end
  33. end
  34.  
  35. first = 2 ^ whatColorFirst
  36.  
  37.  
  38. -- Decide what color the second one is
  39. for i = 1, #colors do
  40.     if second == colors[i] then whatColorSecond = i - 1 end
  41. end
  42.  
  43. second = 2 ^ whatColorSecond
  44.  
  45. -- Decide what color the third one is
  46. for i = 1, #colors do
  47.     if third == colors[i] then whatColorThird = i - 1 end
  48. end
  49.  
  50. third = 2 ^ whatColorThird
  51.  
  52. print(first)
  53. print(second)
  54. print(third)
  55.  
  56. -- OpenPeripherals (see below)
  57. -- net.callRemote("ender_chest_1", "setColors", first, second, third)
  58. chest.setColors(first, second, third)
  59.  
  60. term.clear()
  61. term.setCursorPos(1,1)
  62.  
  63. print("Your enderchest has been dyed!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement