Advertisement
j3d247

Untitled

Feb 21st, 2014
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local l = peripheral.getNames()
  2. term.clear()
  3. function getPeripherals(sType)
  4.   local t = {}
  5.   for _,name in pairs(l) do
  6.     if peripheral.getType(name) == sType then
  7.       t[#t + 1] = peripheral.wrap(name)
  8.     end
  9.   end
  10.   return t
  11. end
  12.  
  13. function setColour()
  14. local t = getPeripherals("cofh_thermalexpansion_lamp")
  15. for i = 1, #t do
  16.   t[i].setColour(colour)
  17.   currColour = colour:gsub("0x","")
  18. end
  19. term.clear()
  20. end
  21.  
  22. while true do
  23. if currcolour then
  24.   term.setCursorPos(1,1)
  25.   term.write("Current Colour: ",currcolour)
  26.   term.setCursorPos(1,2)
  27.   print("Enter Colour (hexcode: RRGGBB) :")
  28.   colour = read()
  29.   colour = tonumber("0x"..colour)
  30.   setColour()
  31. else
  32.   term.setCursorPos(1,1)
  33.   term.write("Enter Colour (hexcode: RRGGBB):")
  34.   term.setCursorPos(1,2)
  35.   colour = read()
  36.   colour = tonumber("0x"..colour)
  37.   setColour()
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement