Advertisement
Guest User

testlamp.lua

a guest
Jun 9th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. local component = require("component")
  2.  
  3. lamplist = component.list("lamp")
  4.  
  5. colortable = {}
  6. colortable[1]=1024
  7. colortable[2]=2048
  8. colortable[3]=3072
  9. colortable[4]=4096
  10. colortable[5]=5120
  11. colortable[6]=6144
  12. colortable[7]=7168
  13. colortable[8]=8192
  14. colortable[9]=9216
  15. colortable[10]=10240
  16. colortable[11]=11264
  17. colortable[12]=12288
  18. colortable[13]=13312
  19. colortable[14]=14336
  20. colortable[15]=15360
  21. colortable[16]=16384
  22. colortable[17]=17408
  23. colortable[18]=18432
  24. colortable[19]=19456
  25. colortable[20]=20480
  26. colortable[21]=21504
  27. colortable[22]=22528
  28. colortable[23]=23552
  29. colortable[24]=24576
  30. colortable[25]=25600
  31. colortable[26]=26624
  32. colortable[27]=27648
  33. colortable[28]=28672
  34. colortable[29]=29696
  35. colortable[30]=30720
  36. colortable[31]=31744
  37.  
  38. countdown = 1000
  39.  
  40. while countdown > 0 do
  41.  
  42. for color=1,31  
  43. do
  44.   for address in lamplist
  45.   do
  46.     setcolor = component.proxy(address) setcolor.setLampColor(colortable[color])
  47.   end
  48.  
  49. end
  50.  
  51. os.sleep(2)
  52.  
  53.  
  54. color = 31
  55.  
  56. while color > 0
  57. do
  58.   for address in lamplist
  59.   do
  60.     setcolor = component.proxy(address) setcolor.setLampColor(colortable[color])
  61.   end
  62.   color = color - 1
  63. end
  64.  
  65. countdown = countdown - 1
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement